Playing soccer is exercise in and of itself, that's how. Of course, elite players work out so they can play soccer (etc) better, but the game itself is excellent exercise, hence it's a sport.
Then competitive driving is a sport too since it's excellent exercise by itself too. Of course serious racers work out so they can race better, but competitive driving itself is excellent exercise, hence it's a sport. Actually some competitive motor racing sports are among the most physically demanding sports in existence.
While I don't necessarily disagree, I still don't think many (anyone?) goes for a drive for exercise, and if they do, then I'm pretty sure a coach of some sort would tell them "You're doing it wrong. Drive for practise; play sports for exercise, stamina, cardio, strength..."
I know a lot of people who use go-karting as a way to train their stamina, cardio, strength and have fun. Other kinds of racing sports are typically much more expensive, so you are unlikely to do them exclusively for "exercising", but go-karting is relatively affordable.
Most coaches would tell you you're doing it wrong if you play soccer as exercise too and they would be actually technically right: without the proper physical preparation it's pretty easy to get injuried. Actually exercise is not the reason most people play soccer anyway: they do because they enjoy playing it, not because they want to exercise.