The primary purpose is isolation. Typically they are also used as part of the signal conditioning, turning a pair of single-ended drives into a differential signal on transmit and establishing the correct common mode voltage for the receiver on receive. For this reason the device-side of the transformers is usually center-tapped.
Isolation is a very good idea in communications systems that are linking lots of hardware over a wide area. You don't want fault current/voltages in from faults in the mains wiring or devices to spread through your communications wiring.
There are basically two options for isolation, opto and transformer. Transformer isolation has a couple of major advantages. Firstly, the signal power passes through the transformer, which means you don't need to get a power supply to the "isolated" side of the barrier. Secondly, transformers are very good at generating and receiving differential signals while providing high common mode rejection; this makes them a good combination with twisted-pair wiring. Thirdly, it is easier to design transformers for high frequency (aka high speed) than optocouplers.
Transformer coupling does have some downsides; transformers don't work on DC, and small transformers that work well at high frequencies don't work well at low frequencies; but this is easily dealt with through line coding schemes that avoid low frequencies.
Jansum Electronics as a professional Isolation Transformer manufacturer, you can rest assured to buy Isolation Transformer from our factory and we will offer you the best after-sale service and timely delivery.