|MadSci Network: Zoology|
It depends on the type of fish.
You probably already know that fishes breathe in water using gills. Some fishes, such as the freshwater bettas and gouramis, can actually breathe air. In addition to the gills that you would expect to find in a fish, this group, the labyrinth fishes, have a special structure called the labyrinth organ with can absorb oxygen from both water and air. Bettas and gouramis regularly gulp air at the surface and sometimes also burp up little bubbles of air.
Male labyrinth fishes also blow bubbles at the surface of the water to form a nest. Bubble nests are collections of small bubbles and look like foam -- see here. The fish forms the bubbles by wrapping mucus around a tiny bit of air. The mucus makes them sticky, so the bubbles pile together and float like a raft at the surface. The female spawns her eggs into the nest, where the male will fertilize them and take care of them while they develop.
Some fishes also burp up air bubbles as part of the buoyancy control process. Most fishes have an internal air-filled cavity called a swim bladder (see bottom of this page) or gas bladder. The gas keeps the fish neutrally buoyant, which means it counters the fish's natural tendency to sink, so the fish doesn't have to expend a lot of energy keeping itself up in the water column. More gas in the bladder means that the fish will rise, and less gas means the fish will sink. The swim bladder can be either attached to the fish's digestive system near the stomach, or separate from the digestive system. If the swim bladder is attached to the gut, the fish adds air to the bladder by gulping air at the surface and releases air by burping. This burping may be the source of the bubbles that you see. In fishes where the swim bladder is completely separate from the gut, there is an elaborate biochemical process that moves air in and out of the bladder which is also described here.
I hope this answers your question!
Allison J. Gong
Try the links in the MadSci Library for more information on Zoology.