It's been for long known that vitamin D is essential for good bone developement and that its lack causes rickets. Vitamin D can be obtained from some foods (fatty fish and mushrooms specially) but it's mostly generated in the skin photochemically, what requires some absorption of (otherwise dangerous) UV rays from the Sun. Therefore it has been considered for many decades a most important evolutive factor in the developement of low pygmented ("white" or "pale") skin type in West Eurasia and specially Northern Europe, where solar radiation is extremely low due to latitude and cloudiness. The rationale behind East Asians and, specially, Siberian natives not being generally as pale as Northern Europeans is because of their food habits: most often rich in fish (that is one of the main food sources of vitamin D).
Now a new study (see news article) suggests that it is also important for a correct brain developement function, with this vitamin being very active in our brains, and also acting as protection against autoimmune diseases.
In brief: vitamin D seems essential for correct human developement and, while in our original tropical latitudes we had no problem obtaining it directly from the Sun, rather needing protection against excess of UV rays (hence black or dark skin), when we entered the northern latitudes where the solar input is much smaller, we needed other strategies to adapt to this important bological conditionant. A fish-rich diet was one possibility but surely was not available for all. So light skin was a natural evolutionary goal, specially for those living in the darkest places.
There are indications that some of the genetic variants (mutations) involved in light skin among Europeans may have evolved quite recently, maybe as late as the Epipaleolithic, coincident with the colonization of Northern Europe after the ice shield melted out. The evidence is quite compelling anyhow in the sense of Eastern and Western Eurasian pygmentation genes having evolved separate but parallely (i.e. after both branches separated somewhere in southern Eurasia, maybe 50,000 years ago). Still, the genetics of pygmentation is poorly understood by the moment, as there may be dozens of different genes involved. In any case, it seems clear that evolutionary pressures related most specifically with vitamin D processing were central in this differentiation.