Getting a flat tire doesn't necessarily mean you're about to buy four new tires. In some situations, replacing just one tire is perfectly possible, although it depends on how much tread remains on the other tires, the type of vehicle you drive, and what the manufacturer recommends.
The problem is that a brand-new tire can have significantly more tread than the three tires already on your car. That difference changes the tire's rolling circumference, which can affect handling and, on some vehicles, the operation of electronic and mechanical systems.