"Drinking water" may not be the most appropriate term to explain why the fish - fresh or salt water - ingest the liquid.
Contrary to what happens with humans, the water absorbed by the fish is mainly used for breathing and gas exchange with the external environment in which they live.
Only a minimal amount of liquid is actually ingested together with foods, as well as with other animals that live outside the water.
In fish breath, the water comes up to the gills so that the gas exchange happen. It is through this body which oxygen is absorbed and eliminated carbon dioxide - which in humans occurs in pulmonary alveoli.
The fish maintain a constant exchange with the water in which they are so there is a balance between the amount of salts present in the environment and animal body. Thus, the fish eliminates or absorbs more water according to the environment where they live.
In freshwater fish, the salt concentration is greater in the body than the water that surrounds it. Therefore, the water enters passively in the fish body (the cell), a process known as osmosis. It's like she was "attracted" to the body. By absorb much water, freshwater fish have the most developed kidney and excrete a very dilute urine and plenty of it.
Already in saltwater fish, the process is reversed. The high salt content of the oceans causes the water "skirt" of the body by osmosis, so the animal must constantly "drinking" water to maintain their functions. As the seawater is very salty, the fish that live there need to flush out excess salt through a special mechanism in the gills.
When the fish ingest the water, mouth closed and very small bones (opercula) clog the gills. Thus, there is a pressure that pushes water into the gill filaments, responsible for breathing. After the process, the fish back to open his mouth and eliminates water.
And there's cartilaginous fish such as sharks and rays, which make this change otherwise.
In them, osmotic equilibrium is because the production of a substance called urea which, when secreted into the bloodstream by the kidneys of these animals can control the amount of salts in the body.