The primary function of rectifiers is to convert alternating current (AC) into direct current (DC) by allowing current to flow in only one direction. This is achieved by using diodes to block the negative half-cycles of the AC waveform, resulting in a pulsating DC output.