Water is composed from two hydrogen and one oxygen molecule (hence the chemical and colloquial name, H2O). Some of these constituent components are as old as the universe itself. In fact, they may well have come from the Big Bang 13.7 billion years ago.
As the soup of particles in the first minutes of the universe began to cool and coalesce, nearly three quarters of those particles found themselves in the simplest combination: one neutron, one proton, one electron. A.K.A. Hydrogen. 75% of the elements formed in the early universe were hydrogen. The other 25% were Helium-4, with traces of Deuterium (one proton and one neutron only), Lithium, and Beryllium – the lightest and simplest elements on the periodic table. This process of element creation is known as Big Bang nucleosynthesis.
But oxygen is not among those elements. The oxygen in our universe comes from stars. As stars age and undergo a cyclic process of expansion and collapse, they produce heavier elements with each cycle. First, they fuse hydrogen, then helium, then carbon (the basis for lifeforms on Earth), then oxygen (a major constituent of what we breathe), then neon, then magnesium, then silicon (the basis for our computers), and finally, if the star is large enough, iron.
When massive stars die, they blow out most of their material in a spectacular display known as a supernova. Our own sun is too small and cool to undergo this process. We are fortunate, though, that, throughout the history of the universe, other stars have gone supernova, since these supernovae are thought to be the distribution mechanism for carbon, oxygen, silicon, and iron.
Freed from the interior of a dying star, oxygen and hydrogen eventually made their way to us on Earth. (Click the right arrow, below, to navigate to the next destination).
Distance to next destination: 8.2 billion years