The first atmosphere of the Earth was very different from that of today. There was no free oxygen but high levels of carbon dioxide produced by continual volcanic eruptions. This provided the original green house effect, allowing the Earth to be warmed by the trapped rays of the Sun. By 1800million years ago oxygen began to be produced by algae photosynthesizing, and first appeared in the atmosphere.
The amount of oxygen continued to increase but was still probably only two thirds of the present level when the first animals appeared 670 million years ago. Only after the ozone layer formed did it become safe for animals to leave the sea and respiration became mainly aerobic.
During the Mesozoic era there may have been more oxygen than today as a result of algal blooms. It cannot have been more than about 24 percent or forest fires would have raged out of control. One theory suggests that dinosaurs achieved their large size thanks to abundant oxygen ad became extinct when levels fell. The other side of the story of increasing oxygen has been one of decreasing carbon dioxide.
As the Sun warmed, life kept pace with it by consuming the greenhouse gases and converting carbon dioxide into thick deposits of limestone, chalks and fossil fuels. Now humans are burning those fuels, releasing the carbon dioxide back into the air. And the forests that recycle it back into oxygen and organic matter are being felled, so the greenhouse effect is increasing. Various predictions suggest that average global temperatures could rise by several degrees as a result.