This problem is called atmospheric distortion. Astronomers avoid it as best they can by building ground-based observatories on mountaintops, where the atmosphere is thin.
Look up at the night sky, and you’ll see that the stars seem to be twinkling. Earth’s atmosphere causes this effect by bending the light in random directions. When a telescope on the ground looks up at the night sky through the atmosphere, it gets a blurry image.