it keeps the pipe from falling off and I'm not kidding it also allows for some movement of the pipe as there is a slip joint where the springs are usually between the head and the pipe and a place for the oily nasty poo to leak out of all over your leg and shoes.
To hold the exhaust pipe to the exhaust flange. Like alot of off road motorcycle the pipe is not attached directly to the cylinder, rather a flange is bolted on to the cylinder exhaust port, with a short protruding piece of pipe, and the exhaust is slipped over that pipe, and held tight against the cylinder flange with springs. The benefit would be that the pipe is less likely to break from vibrations
Or crack the cylinder. Also it gives you more options to make your pipe fit better without tweaking the pipe. I've noticed that when I use a pipe without a separate flange or header pipe, either the header pipe or cylinder would crack.