Although mentioned in the references above adequately, the important thing to understand about inductors is that they operate with current, a voltage is then induced according to the time variation of current in the inductor.
So you always need to think about the current. It's like a garden hose, you can't start and stop the flow instantly, it needs time to build up and decay, switch the flow too quickly and you will get water hammer in the hose. If you need to accurately fill a bucket with a hose, then you need to divert the flow when the desired level is reached.
So when voltage is first applied to a relay coil the current slowly builds up, let's say it takes 8milliseconds at 12V until you get 20mA through the coil. When you need to turn off the relay, the current is still flowing, and the voltage will reverse because the current is still trying to flow (but has nowhere to go), and (without the diode) it might rise to 120v for 0.8milliseconds to discharge the coil. To prevent damage, What you need to do is divert the 20mA somewhere else, that's what the diode does, the current circulates around the diode and coil. (It doesn't go back to the supply as mentioned elsewhere), the energy is dissipated in the coil resistance and the diode.
Going back to the hose analogy, to "turn off" the flow , we simply connect the hose outlet to the hose inlet, water will continue to circulate briefly in the closed loop, but there won't be any water hammer in the hose.