Vit D is essential to health and to healthy growth, especially bone growth. Almost all of human Vit D is produced by skin in response to UV solar radiation. Animals with fur and feathers produce their own.
In its favor, it seems to help prevent some cancers and heart disease, so it is a good guy.
In the US, Vit D is added to commercial milk to make sure kids get some. About 15-20 minutes/day of unprotected sun seems enough to raise Vit D levels but few people get that daily. Sunbathing nude, of course, makes it quicker. Some of it is stored in fat cells for a while, until it gets used up.
Recent evidence suggests that sunblock does not prevent Vit D production in skin very much. In temperate climates, it's not a bad idea to take oral Vit D. I do, and all of my MD friends do. Few people sunbathe in January around here.
When it comes to sun damage and skin cancers, sunburn seems to be the criminal, not some wholesome sun.