Then God said, “Let the land produce vegetation: seed-bearing plants and trees on the land that bear fruit with seed in it, according to their various kinds.” And it was so. Genesis 1:11 NIV
Before these was anything else, there were single celled organisms that used carbon dioxide and produced oxygen as a by product. Molecular oxygen is not stable in a planets atmosphere and so life processes must be present in order for there to be oxygen. And so, the first thing God did after creating our planet, was to create living creatures so that you and I could breathe. Below is a link to an article from the Biologos Foundation that explains how this works.
By the way, since there is no known way for molecular oxygen to exist in a planet’s atmosphere without biological life processes, the search for life in far off planets is focused on the chemical composition of the atmosphere in the hope of finding oxygen.
Peace, Pastor Bill