Oxygen is matter, just like dust or rock or
water. As such, oxygen is affected by gravity.
Because oxygen is less dense than the other
materials that I just named, it tends to float
above them, becoming part of the air, along with
other gasses in the air (mainly nitrogen). Air
only floats because it is sitting on top of
other air; otherwise, it would fall to the
ground, too. In space, you've ran high enough
that there's no more air.