Melanin reduces the amount of vitamin D synthesized in the skin for the same reason it has protective effects against sunburns.
Historically this wasn't a problem since people with more melanin live in sunnier, more UV intense regions. In fact, pale skin may have been an adaptation as people moved north from the equator to combat the decrease in sun exposure/intensity. But people spend much less time outdoors today with AC and the internet, so vitamin D deficiency is especially prominent in dark skinned populations.
Historically this wasn't a problem since people with more melanin live in sunnier, more UV intense regions. In fact, pale skin may have been an adaptation as people moved north from the equator to combat the decrease in sun exposure/intensity. But people spend much less time outdoors today with AC and the internet, so vitamin D deficiency is especially prominent in dark skinned populations.