Leaving aside the obvious answer that humans often deliberately introduce fish to lakes and ponds, we can draw a comparison with the population of isolated islands. Just as an island may once have been connected by a land bridge, so lakes may originally have been part of river systems that dried up. Or a river may have flooded long ago and briefly flowed into low-lying land to create a populated lake.
Some lake residents are even descended from ancestors that crossed from one lake to another. While most fish can’t travel very far over the land, their eggs will survive for several hours out of water. When waterbirds come to lakes to feed, fish eggs might get stuck to their feathers, hitching a ride to a new home.