The current that goes throug the coil of your relay is, when stabilised, creating a magnetic field around the coil. Some energy is stored there. When you cut the current, that energy must be spent somewhere. It tends to continue to push the current throgh the coil, and becouse it is cut off from the rest of the circuit ( by stopping the transistor from conducting), exess voltage is collected at collector of the transistor ( the current is charging the cappacitance of the collector).
This curret can be closed to the coil itself by placin a diode across the coil, reverse polarised to the nominal direction of the current throug it ( so when you want your relay to close, the current goes through the coil, and diode stays inversly polarized. When you shut the transistor, circuit closes through the diode, and the energy stored in magnetic field is dissipated on coil's internal resistance.
I hope that this is clear enough...
For more theory read somenthing related to Lentz's law.