There are 252 stable nuclides, plus another 34 nuclides that have half-lives long enough to have survived from the formation of the Earth. These are the primordial nuclides. The 34 primordial radionuclides are isotopes of 28 separate elements.
Oxygen is one of the primordial nuclides. Onviously, it is found on Earth in rocks and in the atmosphere. The molecules have existed in their current form since before Earth was formed. Primordial nuclides were present in the interstellar medium from which the solar system was formed. They were formed in, or after, the Big Bang, by nucleosynthesis in stars and supernovae followed by mass ejection, by cosmic rayspallation, and perhaps by other processes.