photosynthesis
You could argue that oxygen is one of the most important, if not THE most important molecule necessary for life. However, oxygen is essentially just a waste product of the light reactions of photosynthesis. It is a "leftover" from a necessary part of the process. All the oxygen that is necessary to maintain most forms of life just happens to be released from the plant during this process.