Many of them take animals that are rescues, have serious injuries and many can't be returned to the wild. Some zoos have breeding programs and attempt breeding and release work. Some zoos even have endlings, the last of a species that can only survive (for now) in captivity.
Most zoos are small and bad, but there are a few good ones that try to provide a good amount of space and comfortable living for animals. The San Diego Zoo, Cincinnati Zoo and Melbourne Zoo are all good examples.
Also, with some animals, keeping them in zoos in the best place for them because they wouldn't survive in the wild. Many zoos have permanently injured birds, for instance, that can't fly any more, and there's also albino animals (like white tigers) that can't live in the wild.
[0] http://www.torontozoo.com/Conservation/captive-breeding.asp
https://www.parl.ca/DocumentViewer/en/42-1/bill/S-203/third-...
While I really love the Toronto zoo, watching their lynx pace back and forth in the cage, digging a path into the ground, that really impacted my impression of zoos generally. Perhaps large[0] cats like that don't belong in small enclosures.
[0]Lynx are actually much smaller than I expected, and bobcats even smaller than that. Still, they need a large space to thrive.
As for needing a large space to thrive: that would be nice, but they can't really live in the wild in most places any more because stupid humans will kill them. This is the whole reason deer are so overpopulated in many places in the US; lynxes are their normal predators.
Our treatment of animals (pets, meat) is one of the indicators of how primitive we still are as a civilization... or, god forbid, species.