When a relay is switched off the collapsing magnetic field results in sparks over the switch contacts. This may cause these contacts to burn in and fail over time. Also radio interference and possible electronics failure is to be expected from these sparks.
To resolve this, a diode is place parallel to the coil so that when the power is switched off the resulting (reversed) voltage over the coil is shorted and no sparks will be generated.
The document below shows a diode acting as a surge suppressor.
Excerpt from the document:
These spikes can be caused by several things, but the most probable is the collapsing magnetic field of the engine starter solenoid. They are easily eliminated with the addition of a “SURGE SUPPRESSOR DIODE” installed on the solenoid. These diodes are often supplied by the starter switch supplier along with installation instructions.
The installation of the Surge Suppression Diode should prevent damage to your expensive electrical equipment that is turned on when starting the aircraft engine.
To continue reading see the pdf below: