Optical astronomy is only possible during local night. This poses a problem to astronomers because modern civilization creates a lot of light at night, which is reflected off the atmosphere and thus precludes a clear, ground-based view of the cosmos. Observatories are placed atop remote hills and mountains, but light pollution is still a problem, especially near the horizon. Light pollution is not a problem for space-based telescopes. In fact, space-based telescopes have approximately twice as much available active time, because it's never daytime in space.
The Earth's atmosphere is turbulent and ever-changing. Pockets of air with different densities can distort the light that passes through them like a lens or the surface of a pond. The atmosphere also scatters blue light, which is why the sky is blue, and blue is an important color to astronomers because the blueness of light can help determine whether the object that emitted or reflected it is moving toward or away from the Earth. Because space-based telescopes are outside the atmosphere, they don't have these problems.
Weather is also a major factor in the effectiveness of ground-based telescopes. You can't see the stars on a cloudy night. Space-based telescopes are above the clouds, so the weather is irrelevant.
Astronomers have limited options when choosing a location for an observatory. It must be as far away from cities as possible, yet have access to electricity and roads. Placing a telescope in orbit gets around these problems. A space-based telescope can be positioned optimally to take images from any direction.