In normal use, a small current on the base of the transistor allows a much larger current to flow between the emitter and collector.
In this case, however, we have a large voltage applied across the emitter and collector, with (presumably) little or no current flowing through the base, so the transistor is trying to stop current from flowing between the emitter and base.
In this case, it's probably useful to think of the transistor as a pair of diodes, with (depending on whether it's an NPN or PNP transistor) either their anodes or cathodes connected to each other.
One of these diodes is going to conduct current from the emitter/collector voltage. The other is going to try to block it. One question, then, is what's the breakdown voltage of that "diode" (that junction of the transistor). If the voltage being applied exceeds that value, you're liable to toast the transistor.
Now let's consider that added diode, and what it does.
We connect the diode so the transistor's power supply is trying to push current in the direction that the diode won't conduct. Therefore, when the transistor is operating normally the diode basically has no effect at all1 (unless we choose the wrong diode, such as one with a breakdown voltage lower than our power supply voltage).
For a voltage in the opposite direction, however, the diode looks/acts pretty much like a dead short. This means all the current from that reverse voltage flows through the diode. Since it acts like (nearly) a short circuit, no voltage can be developed across the transistor, preventing any damage to the transistor.
1. "basically" meaning that, for example, it will add a little extra capacitance. If we were dealing with a high enough frequency, we might need to figure that into calculations about how the circuit works--but for a typical motor driver, we're dealing with low enough frequencies we don't normally care.