Undersuits provide crucial thermal protection when diving, trapping air and maintaining body heat during the dive and also between dives. Modern undersuits can range from simple fleece type garments to advanced suits with anti-compression panels or even built in heating.
Your thermal requirements will depend on water temperature, your suit type and how much you feel the cold. water transfers heat from the body up to 25 times faster than air which means a divers will quickly start to feel the cold without protection, the colder the water the quicker the onset and the greater the need for undersuits and base layers.
Drysuits have their own thermal properties, some are much better than others. Membrane suits are much warmer and require thinner undersuits but membrane suits provide very little thermal protection and therefore require thicker or even layered undersuits.