Yes, hyperpigmentations must be protected from sun exposure as much as possible and you should always apply sunscreen on your face but you can occasionally expose the skin elsewhere to get vit. D.
The problem is that UV radiation damages collagen and it can damage DNA but at the same time it is crucial for our health because sunshine is by far our most effective source of vit. D, which forms in the skin upon sun exposure.
Vit. D is very important for many reasons including proper functioning of our immune system - crucial to remain healthy. Many recent studies showed that vit. D even plays a role in cancer prevention.
Thirty minutes of full-body sun exposure causes the synthesis of 10,000 to 20,000 IU vitamin D. Taking such amounts in supplements would be toxic - for a reason not fully understood. The levels are not toxic if triggered by sun exposure. Oral supplementation of vit. D is is not a full substitute for sun exposure. Vit. D, a hormone, really is intended to be created in our skin, not absorbed by our digestive system. However, supplementation and food intake with vit. D is better than nothing, especially in winter time.
I am not advocating excessive sun exposure or sunbathing! I am advocating very reasonable, occasional, 15 minutes lasting sun exposure.
You do not have to expose yourself very often. The half-life of vit. D is long - about 8 weeks. It means that the existing levels of vit. D in your body will halve every two months.