Then animals started getting harder to find and dealers started charging more and more money. Zoos started getting the seeds of an idea that maybe wild populations of these animals might be getting scarce, and so conservationist ideas, captive breeding programs and SSP's were eventually born. I think these days most animals in zoos come from trades with other zoos and breeding programs, and far fewer animals come out of the wild. But the "All of the Above" answer is still probably the most correct.
I wish most zoos, or rather, the people in charge back then, had been that noble and thoughtful; the reality was a little different. Starting in 1960s and increasingly in the 1970s/80s, the
Environmental movement became more and more prominent in Western society, resulting in public pressure also in regard to zoos and the animal trade. As a result, CITES and similar resultions came into existence, making the legal (and partly also the illegal) commercial trading of animals more difficult for all involved. That, together with a changing public attitude torwards zoo husbandry and the trade/exhibition of wild animals in general, forced zoos to establish self-sustaining zoo populations of at least the most popular species. To hit two birds with one stone, this was also described as practical conservation work, although the real merits here are still rather dabatable...
When it comes to popular mammalian crowd pleasers like Great Apes, Big Cats, giraffes, zebras etc., most of the ones now exhibited in western zoos are captive-, or rather, zoo-born and when needed, transferred from one zoo to another, sometimes according to a breeding plan/stud book coordination (although, for example, some of the older Apes or 'pachyderms' in zoos were often taken from the wild as juveniles). However, there are also exceptions with a non-zoo origin, like the recent Southern White Rhino transfers from South African game farms to European zoos or the elephants, transported from Asian work elephant camps to the Cologne zoo.
Some zoo animals are bought from the commercial pet trade and professional/(rarely) hobbyist breeders; some (but usually less than in the past) are 'confiscations' of illegal activities (animal smuggling, illegal pet husbandry...), wild "orphans"/"invalids" unfit for reintroduction or, rarely, former labratory animals/pets. Some few specimens are taken from the wild as part of an conservation program (like Bali Mynah, Partula snails or Visayan Warty Pig) to establish an ex-situ breeding group.
Animal exchange between zoos does still exist, too.
However, when it comes to many "not so popular species", especially on the field of fish and, to a lesser extent, exotic invertebrates, smaller reptiles or various bird/small mammal species..., quite a lot of what you can see in zoos are wild-caught, as so far, no self-sustaining captive populations exist of these very species.
EDIT: I forgot to mention two other ways for zoos to obtain certain animals: a) as a diplomatic gift (like several Giant Pandas in the past, Copenhagen's Tasmanian Devils or Berlin's Aye-Aye) b) as a loan (once again, Giant Pandas, or Audubon Zoo's leucistic alligators...).