So, just to be clear, there is plenty of oxygen on Mars and any other rocky planet. Nearly every mineral is some kind of oxide, and in terms of elemental mass oxygen forms 46.1% of Earth’s crust (CRC Handbook of Chemistry and Physics, 89th Ed), and probably something comparable for Mars. (It’s a little difficult to say exactly how much because of the limited surveys for Mars but of the the fourteen chemical compounds listed Chemistry of the Solar System (2011, Lodders and Fegley) as surveyed by the Viking I & II, Pathfinder, and MER-A and -B, thirteen are oxides with silicon dioxide (SiO2) being 42% to 46%, ferrous oxide (FeO) 15% to 20%, aluminum oxide (Al2O3) in the 7% to 10% range, manganese(II) oxide (MgO) in 6% to 9%, sulphur trioxide (S O3 at about 6% to 8%, calcium oxide (CaO) at 6% to 7%, and all other compounds in the single digit percentage range. The oxygen, like all ‘heavy’ elements, comes of course from stellar nucleosynthesis, predominately the CNO (carbon, nitrogen, oxygen) fusion cycle in heavy stars and is distributed by supernovae and stellar wind.
So, oxygen is highly abundant, and your query is about ‘free’ diatomic oxygen in the atmosphere. Although Mars does have an atmosphere (the only rocky body in our solar system other than Earth, Venus, and Titan to have a viscous fluid atmosphere) that has a high proportion of oxygen, the atmosphere is very thin (surface pressure is about 0.6 millibars, or just over half a percent of that of Earth). Mars did once have a much thicker atmosphere which we know because we can observe the residues and geological features of liquid water flowing on the surface, which means that it had to have had a pressure of at least a few hundred millibars to maintain steady concentrations of liquid water. We can only speculate about the actual climate during the first billion or so years of Mars but it was probably somewhat akin to Earth today. However, the loss of a rotating liquid ferrous core resulted in collapse of its magnetic field and the loss of virtually all of its atmosphere (not just oxygen but all species lighter than carbon dioxide) and vaporization or freezing of surface water. There are thick briny recurring slope lineae that allow ‘liquid water’ to flow today under peak surface temperatures of about 20 °C but these are more like a thick sludge.
Because oxygen tends to bind with nearly every other element (literally ‘oxidizing’ them into minerals), finding an atmosphere with ‘free’ diatomic oxygen would be indicative of either very energetic or highly organized chemical reactions which are continuously releasing oxygen from bound states. There are relatively few known or hypothesized natural phenomena that would continuously cause or catalyze the release of oxygen, and virtually none that could produce the concentration of oxygen seen in Earth’s atmosphere other than systems of living organisms, hence why the presence of diatomic oxygen in the absorption spectra of an exoplanet would be highly indicative of the presence of some kind of life-like system, which would no only release oxygen from the air (as photosynthetic plants do) but also from minerals in the ground (as certain archaea do). The same is true with other oxidizers like chlorine or fluorine, although any life-like systems based upon the latter would certainly be far more energetic than Earth life.
The curious thing about Mars (and all of the the other rocky bodies in the Solar System that have been surveyed) isn’t the lack of oxygen or an oxygen-rich atmosphere, but the diminutive amount of nitrogen that is found. While the chemical abundance of nitrogen in the universe is only about 1/10th that of oxygen, we actually only find trace amounts on Mars and other bodies, and yet it forms ~78% of our atmosphere and performs both critical climatological and biological functions without which Earth would not support life as we know it. There is virtually no nitrogen or nitrates to be found on Mars and only about 3.5% in the atmosphere of Venus, which is much less than a cursory assessment would expect, and nobody really knows why.
Stranger