There is a simplified expression that the current through the inductance cannot be changed instantly. So when you close the transistor (switch or anything else), the current continues to flow through the inductance causing the reversed voltage drop (according to normal current flow). The voltage drop may exceed several kV that results is sparks (in fact that is the "closing" of current loop) and damages. If you have a diode across the inductance, then after switching off the transistor, the voltage at the lower pin of the inductance becomes greater than at the upper pin and the diode becomes forward-biased and current safely flows using green path on the picture above.