In Genesis 6, we read where God commands Noah to take two of every kind of land-dwelling animal on the ark. This includes the mammals, birds, and reptiles, but not the fish. There is some debate if insects were included. During the flood, the salty ocean waters would have mixed with the fresh lakes and rivers. How did the fish in the fresh waters survive in the salty mixture? How did the saltwater fish survive in the fresh mixture?
There are many areas in the world where freshwater and saltwater are together, but the waters don’t mix. Studies on water have shown that various temperatures, chemistries, and sediments in the waters don’t mix but instead become segregated. It is possible that the fish survived in “pockets” of fresh or salt water, depending on the species. Before the flood, the fish would not have been affected as strongly by the curse like they are today, so they may have been able to tolerate the water mixes during the flood and adapt to the different chemical makeups. It should be noted that the majority of fossils are marine creatures, so most fish died during the flood when they were buried by sediments. We know that two of each kind of fish survived, though, because we see them and their variations swimming in bodies of water today.
For further reading on this often asked question, see the two following articles: