During photosynthesis, plants absorb CO2 from the atmosphere through their stomata, small pores on the surface of their leaves. This CO2 is then combined with water, which is taken up by the plant's roots, to form glucose, a sugar that plants use for energy. As a byproduct of photosynthesis, oxygen is released into the atmosphere.
The oxygen produced by photosynthesis is essential for life on Earth. It is the gas that we breathe, and it is used by all aerobic organisms for cellular respiration, the process by which organisms convert glucose into energy. Without photosynthesis, there would be no oxygen in the atmosphere, and aerobic life on Earth would not be possible.