Too much UV penetrating the skin (too pale-skinned under intense sunlight) increases Vitamin D but reduces folate. Lack of folate causes neural tube defects in the fetus, causing such congenital abnormalities as craniorachischisis, anencephalus, and spina bifida, leading to many miscarriages.Why Are Europeans White?
On the other hand, too little UV penetrating the skin (too dark-skinned under dim sunlight) increases folate but reduces vitamin D. Lack of vitamin D causes skeletal neonatal abnormalities (skull, chest, and leg malformations), rickets being the best known. Again, this causes miscarriages.
And so, humans adapt very quickly to solar UV. Prehistoric groups that migrated towards the equator got darker. Prehistoric groups that migrated away from the equator got lighter.
But this explanation fails for Europe. Northern Europeans are lighter than everyone to the south (Mediterraneans), to the east (Mongols and east-Asians), to the west (Native Americans across the Atlantic), and to the North (Inuit, Sammi, Chukchi, Aleut).