Most of water's oxygen comes from the atmosphere, which is in a constant state of transfusion with the water's surface; the exchange of molecules between water and the atmosphere always strives towards equilibrium: gaseous water in the atmosphere, and oxygen in the liquid water. Movement of water exposes more or less surface to the atmosphere, exchanging oxygen through osmosis.
Plants with their roots or entire bodies underwater also exchange oxygen; just like terrestrial plants, underwater plants take in carbon dioxide (as exhaled by fish) and expel oxygen; a portion of this returns to the water, allowing life in the aquatic ecosystem to continue in a stable manner. All plants are fed carbon dioxide by the respiration of the animals in the ecosystem, and most use photosynthesis to convert carbon dioxide into energy and oxygen.
An aquatic ecosystem relies on the oxygen content of its water to keep plants and animals alive. Water contains oxygen naturally, since it is composed of two hydrogen atoms and one oxygen atom (H2O), but fish in-take the water and remove a portion of oxygen from it, expelling carbon dioxide just like humans; their carbon dioxide is dissolved in waste water, as they don't use up all the oxygen with every breath.