|MadSci Network: Earth Sciences|
That's kind of a huge question- pretty much any compound you can think of occurs in the oceans! I'll stick to the really important compounds.
About 4 billion years ago, the earth was basically a large hot rock. Water is believed to have arrived on earth from outgassing from within, as well as from comet impacts (comets are composed entirely of ice).
By around 3.8 billion years ago, the earth had cooled to the point where liquid water could exist. As water condensed from the atmosphere, it picked up minerals from the rocks (it still does) and became salty. By the time that photosynthesis evolved (around 3.5 billion years ago as near as we can tell), there was abundant liquid water, carbon dioxide (as well as methane and ammonia, but we won't get into that), but very little oxgyen.
As you're probably aware, photosynthesis turns carbon dioxide and water into oxygen and sugars. So, in the eons following the evolution of photosynthesis the amount of carbon dioxide gradually decreased and the amount of oxygen increased. For a bit more detail, check out this site: How did the oceans form?, that I found by running this search at google.com.
How do we know this? A very good question! The presence of banded iron deposits is considered the best evidence to date. Banded iron deposits are layers of sediments that contain oxidized iron. They appear at about the same time that photosynthesis is believed to have originated. Because they contain oxidized iron, those deposits could only have occured in the presence of oxygen- it is believed that oxygen produced by photosynthesis is what caused those deposits. You can find out more about banded iron deposits here.
Hope that helps!
Rob Campbell, MAD Scientist
Try the links in the MadSci Library for more information on Earth Sciences.