In a young planet, oxygen can be produced from water vapor via photodissociation, which occurs along a pathway like
$$\text{H}_2\text{O}+h\nu\to\text{H}+\text{OH}$$
$$\text{H}+\text{OH}+h\nu\to2\text{H}_2+\text{O}$$
$$\text{O}+\text{O}\to\text{O}_2$$
In The Atmosphere and Ocean: A Physical Introduction, Wells writes (p. 26)
This gave rise to an oxygen level of 10-4 of the present atmospheric level (PAL).
$\text{O}_2$ would tend to rise, and would have shielded the water vapor (which would have sunk a little, in comparison) from continued photodissociation. Ozone, too, would have been produced, for added shielding, but not yet in amounts as great as in today's atmosphere. So water vapor was a primary source of oxygen in the atmosphere, and thus planets with more liquid water at the start would likely yield more water vapor, and thus more oxygen. However, this can only get you so far (though objections about the absorption of photons by atmospheric oxygen has been questioned; c.f. Brinkman (1969)).
So, why do we have so much oxygen today - 10,000 times as much as was produced abiotically in a young Earth? Well, it's from photosynthesis, beginning with the Great Oxygenation Event over 2 billion years ago. At the earliest stages, this occurred with extremely primitive creatures living in a narrow band near the top of the oceans, deep enough that they were shielded from harmful radiation by high enough that light still penetrated the surface layers (i.e. a band between a few meters and 30 meters below the surface).
This leads to a sort of feedback cycle, if organisms that can use oxygen later develop, creating an Earth closer to the one we live in today. Increases in photosynthesis led to more atmospheric oxygen, and cells evolved to use that oxygen, making the cycle grow more and more.