If you mean a single diode before the regulator, after another DC supply, it is usually for reverse-polarity protection.
If you mean one, two or four diodes after the transformer, before the regulator, it is to rectify the AC voltage from the transformer.
If you mean two diodes, one from the output of the regulator to the input, and one from ground to the output, then they are to protect the regulator if you have a large output capacitor.