Photosynthesis adds oxygen to an environment. Through the process of photosynthesis, plants and other photosynthetic organisms produce oxygen as a byproduct. This oxygen can then be used by other organisms for respiration, allowing them to survive.
The oxygen generated by photosynthesis also led to the formation of the protective ozone layer in the Earth's atmosphere. The ozone layer helps to absorb harmful ultraviolet radiation from the sun, which would otherwise damage organisms on the surface.
The ability to utilize oxygen for respiration allowed for the evolution of aerobic organisms, which require oxygen to survive. This led to a diversification of life on Earth, with a greater variety of organisms able to thrive.
The evidence for this can be seen in the geological record, where the presence of oxygen and the formation of the ozone layer can be traced back billions of years. Fossil evidence also shows the evolution of aerobic organisms and the diversification of life that followed.