Modern Earth is nothing like it was in its early days. Our planet was formed some 4.56 billion years ago when a giant stellar cloud collapsed on itself due its massive size and gravitational force. The explosion also generated the sun and many other planetary bodies, including those that would eventually become the planets of the Solar system. This early Earth was a planet of molten rock surrounded by a layer of hydrogen and helium gases. These gases were likely blown away by the intense solar wind, leaving the planet without a protective atmosphere and making it more vulnerable to bombardment by asteroids and meteorites. At this time, it had a moon called Theia, which some theories believed collided with the Earth with such force that it tilted the planet and made the moon. The impact is also believed to have stimulated the circulation of magma, intensifying volcanic activity in what was already a very inhospitable planet. Not surprisingly, this early era in Earth’s history is called the Hadean (Hell-like) eon. These were indeed hellish conditions that prevented the emergence of life. Yet the Earth began to cool down and, at some point, a thin, but stable continental crust was formed. These ‘milder’ conditions also promoted the condensation of water released through the outgassing of volcanoes. And so a primitive ocean was formed. The volcanic outgassing also released gases such as ammonia, carbon dioxide, and methane and created a primitive atmosphere that helped protect the planet from meteorite bombardment and radiation. It may have been a rocky beginning, but once the planet cooled down enough to form continents and oceans, it was ready to harbor life.
Click "source" to read more.