There is, so far as I know, no in-Universe answer. Pokemon enjoy battling, Pokemon with trainers battle more, recover faster, and get stronger faster, so many Pokemon desire to find a trainer.
In the anime, the Power of Friendship (Warning: TVTropes link) rules supreme: Pokemon love their trainers. Even Meowth, who is fully sapient and has an acerbic personality, is extremely fond of Jesse and James. Not all Pokemon like their trainers or listen to them, but the vast majority either come out of their pokeballs liking their trainers or grow to like them.
In all honesty, there's not much reason for a wild Pokemon NOT to like a trainer who captures them - wild Pokémon typically aren't encountered unless they attack a trainer (or anyone, really) who is traveling. Thus wild Pokémon can control the chances they are captured - if they don't want to find a trainer, they can simply not attack people. Having a trainer means a Pokémon will have access to food, entertainment, medical care, travel, and they can battle and train. It's entirely possible that many wild Pokémon, knowing that this awaits a Pokémon who finds a trainer, will seek out one. Since the vast majority of Pokémon who are encountered sought out the encounter, it's highly unlikely that there are many instances of a captured Pokémon leaving behind a mate or a nest full of eggs. Rather, wild Pokémon seem like orphans seeking a foster parent. Bloodthirsty orphans who know their foster parent will put them into cage matches.
That answer seems to be enough - Pokémon can generally avoid capture if they wish, so those which are captured must have been open to the possibility. It fits the evidence, scant though it is, and works for the general case.
The outliers, however, are where it gets tricky. Consider Pokemon Red and Blue, and the endgame Pokémon you might have had. Articuno, Zapdos, and Moltres are Legendary Birds. They've been legends (literally) for a long time. They actively avoid human contact. Their raw power is said to dwarf that of most creatures (even those like Charizard or Gyrados). Your character, an 11-year old boy, intrudes upon their lairs, pummels them, and stuffs them into a tiny ball. The Birds, who have known nothing but freedom and sought no battle, will obey you just as well as the Rattata from Route 1 that launched itself at you in a desperate bid to escape its overpopulated home.
Why?
The only answer which makes sense, especially given that you can also capture Mewtwo, the most potent psychic that had ever lived, is that something makes them. It is only a theory, but given the evidence at hand it seems reasonable to conclude that there is something special about pokeballs. These devices are capable of storing a living creature the size of a whale in a palm-sized ball that a child can carry. Once captured, the Pokémon can be stored as data on a computer, and sent over the internet.
Pokemon captured in pokeballs can try to escape, and more powerful ones will escape more often. My theory (backed up by no canon information, just extrapolated from it) is that part of the capture process changes the Pokémon's mind. A captured Pokémon has obedience written into its very psyche, most likely tied to the owner's voice (notice how your trainer ALWAYS shouts the Pokémon's name when sending them out?). Pokeballs come complete with an Automatic Stockholm Inducer and make your Pokemon love you. If they resist the brainwashing process, the pokeball spits them back out.
Presumably, pokeballs also have some form of cryptography which prevent the data that represents a pokemon from being duplicated, otherwise Team Rocket would only have to capture one powerful Pokémon, and BitTorrent would do the rest.
Edit: Badges, by the way, make no sense. There's no reason owning a badge would make a pokeball more effective at brainwashing a pokemon you got from someone else. The only way I could envision them working as anything other than a game mechanic is if they're a Magic Feather (Warning, TVTropes link) - by the time you earn the higher badges, you're skilled at controlling Pokemon in battle. Since the badge tells you that pokemon will obey you, you expect them to, and the Pokemon obey the strong, confident voice that tells them to kill. Even if it does happen to be prepubescent.