The question is posed with the assumption that RS-232 was always ±12V.
Unfortunately, the short answer is, it was not always ±12V.
The specification requires that an RS-232 driver outputs a minimum of ±5V and maximum of ±15V when connected with the specified load of one RS-232 receiver. The output is allowed to have up to ±25V when no receiver is connected. The specified receiver load is also within the range of 3k to 7k ohms, so very little current is needed. The receiver must operate properly with ±3V signals to allow for noise margin, voltage drop in wires, and ground voltage difference, and the receiver must not be damaged from ±25V signals being applied.
This allows the RS-232 driver to operate with a wide range of voltages and implemented in any way that simply is within all the electrical parameters listed in the specification. Back in the 1960s when the standard was first written, the interface could have been implemented in various different ways using discrete components, instead of integrated circuits.
I suspect the misconception that it was only ±12V may come from the fact that many common devices that most people are familiar with like the IBM PC in the 80s and compatible successors did have ±12V supply voltages available, which were directly used for RS-232 transceivers when they required separate supplies.
Many devices simply used whatever supplies they happened to have available, like the TI/99 PHP1700 RS-232 Sidecar Interface used ±8V, so it definitely was not ±12V.
Later on when technology advanced and laptops and desktop motherboards started to get RS-232 ports integrated to motherboard, at some point they started to use charge-pump based RS-232 transceivers, which worked with single 5V or 3.3V supply as they generated the driver voltages internally. The charge pump based devices also did not use ±12V, perhaps something between ±7V and ±9V. The details are in the respective datasheets such as MAX202, MAX232, MAX3232 etc, or compatible clones from other manufacturers.
The RS-232 standard also specifically mentions that the RS-232 interface inputs must not be inductive, so the interface signals may not be directly used for driving electromechanical coils like relays or solenoids, and as per the specification, not much power can be drawn from a driver for driving loads anyway.