Sunshine is important for several reasons.
First, sunshine is useful for the production of vitamin D. Vitamin D is manufactured on the skin when that skin is exposed to certain frequencies of UV light. This frequency range is filtered by glass and readily blocked by sunblock, so these things (although potentially still allowing you to be burned) impede vitamin D production. 1
In addition to providing vitamin D, sun exposure — especially first thing in the morning — helps tell the body when it’s night and when it’s day. This, in turn, tells it when to produce hormones at what levels. If you’re only ever in artificial light, the body gets confused, and the hormone balance/cycle may be disrupted, as well. 6
There is wide variation in the air quality from location to location, and some cities have such poor air quality that the idea of “fresh air” is laughable. But in most locations, there is much to be said for getting out in the open, away from enclosed spaces that trap the plethora of chemicals with which our modern lives are built: toxic construction materials, cleaning products, etc., as well as molds and that type of thing. The outdoors offers ventilation from all these things.
Besides the direct benefits the sun and air can provide, getting outdoors is one of the best opportunities many of us have for engaging in other healthy behavior. Grounding is easier outside. Walking barefoot is more pleasurable outside. Getting exercise often happens naturally when we’re outdoors. And spending time outside can help us remember to “stop and smell the roses,” enjoying life and reducing stress.