Earth has had three atmospheres, each different in chemical composition. The first of Earth's atmospheres, formed when the planet was still very young, was primarily hydrogen and helium. This atmosphere is about 4.57 billion years old, and was short-lived – heat from the molten crust and solar wind dissipated this layer. Hydrogen and helium are not heavy enough to make up a stable atmosphere unless the planet is very massive – these elements are more likely to gain escape velocity during random thermal fluctuations. This is part of the reason why hydrogen and helium are very rare in Earth's atmosphere today.
Around 4.4 billion years ago, crust solidified, and numerous volcanoes formed, ejecting steam, carbon dioxide, and ammonia into the skies. Over time, the density of these volcanic gases became sufficient to form a second Earth's atmosphere, primarily of carbon dioxide and water vapor. Some nitrogen was present, but barely any free oxygen. This is similar to Venus’ present atmosphere, which is 96.5% carbon dioxide and 3.5% nitrogen. Earth’s atmosphere at this point had something else in common with Venus – it was about 100 times denser than it is today. The pressure at the surface would have been similar to the pressure under 1 km (0.62 mi) of water.
The Earth’s atmosphere slowly began to rarify as the carbon dioxide was dissolved in the oceans and precipitated out as carbonates. This coated much of the Earth in a layer of carbon, and set the stage for early life.
By 3.5 billion years ago, life had emerged, in the form of archaea. About 2.7 billion years ago they were joined by microbes called cyanobacteria. Cyanobacteria were the first oxygen-producing phototropic organisms, and slowly began to suck in carbon dioxide from the atmosphere and release oxygen. It took a long time for the cyanobacteria to really get started, but between 2.7 and 2.2 billion years, during the early Paleoproterozoic, these microbes converted the Earth’s atmosphere from an anoxic (oxygen-lacking) atmosphere into an oxic (oxygen-containing) state. This is called the Great Oxidation or, more commonly the Oxygen Catastrophe.
The oxidation event is sometimes considered a catastrophe because, to most life forms alive at the time, oxygen was toxic. Therefore the Oxygen Catastrophe was one of the first major mass extinctions. However, as a benefit, we got another one of Earth’s atmospheres, the one we need to survive today.