Vitamin D is part of one theory for the evolution of different skin colors among humans.
Human beings arose with black skins in Africa and then migrated outward from there. Black skin is rich in melanin, a pigment that acts as a natural sunscreen, protecting against sunburn.
But, just like sunscreen of SPF 8 or higher, melanin reduces the amount of vitamin D the skin can make. That's fine for someone in Africa who spends lots of time in the sun. Farther from the equator, however, people with light skin gain an evolutionary advantage. With less available UV-B, light skin probably evolved so that humans migrating northward would still be able to make enough vitamin D.
Indeed, people who failed to make this adaptation would have had a difficult time reproducing. Insufficient vitamin D can lead to rickets, which causes defective bone growth. In women, this can mean such poor pelvic development that babies could not be born--and the mother's genes would not be passed on.