Not so differently from the way we get it from air.
Water contains dissolved oxygen, enough of it to support life.
It's just a question of extracting it. Gills are specialized structures in which the blood comes into contact with the water over a very large surface area, just like in the lungs, blood comes into contact with the air over a large surface area. Argonne National Laboratory, Division of Educational Programs, Harold Myron, Ph.D., Division Director.