Vitamin D synthesis (production) occurs when sunlight is absorbed by the epidermis, the outer layer of skin. Since few foods contain vitamin D, sun exposure is the main natural way that people get vitamin D.