Babies have a waxy coat called vernix caseosa that encompass the body.
In Latin, vernix means varnish and caseosa means cheesy. Or cheesy varnish.
It starts to disappear around a typical due date, but can still be found caked up a little bit under armpits and other body creases. Passed due babies actually lose this coating before they are born and start to show exactly the kind of symptoms you would expect from long term fluid exposure like water logged skin.
The wax/vernix protects the skin from the amniotic fluid (which, as an aside, amniotic fluid is mostly the urine of the baby). Skin wrinkling in water isn’t a direct reaction between water and skin; it is a reaction of your autonomic nervous system. In reality it as a involuntary muscular reaction some attribute to our bodies trying to help us increase our grip when our hands are wet. For example, skin that suffers from nerve damage doesn’t wrinkle in water.
Like many other autonomic functions, it is “turned off” while you’re in the womb… likely because it doesn’t serve any evolutionary advantage at that stage of development like handling wet objects.