Scientists believe the Earth went through a phase known as the Great Oxidation Event, in which oxygen-producing bacteria transformed the planet into the habitable form we know today. In return, they caused the near extinction of the other, anaerobic organisms that existed at the time.
