A variety of marine fish at Atlantis Marine World. But there are even more freshwater species. Photo by Rich Brooks / Flickr.
This question was probed in detail in the paper “Why are there so few fish in the sea?” published by Greta Carrete Vega and John J. Wiens in the Proceedings of the Royal Society B.
In their paper they analyzed the ray-finned marine fishes. This class of fish contains 96% of all fish species in both freshwater and saltwater and is also the most species-rich class of marine fishes. What was interesting from their analysis of the species distribution between freshwater and saltwater was that they were both essentially identical (15,150 species versus 14,740 species). Why was this given the huge difference in size between saltwater and freshwater environments?
Using trait reconstruction to analyze fish in this class, they found that marine fish were derived from a freshwater ancestor. What this implied was that there may have been a mass marine fish extinction that wiped out the majority of marine species and that the current marine fish evolved from freshwater species that re-acclimated to marine environments.