Exposure to sunlight (or lack of it) affects our circadian rhythm and production of melatonin, which affects our sleep quality. Exposure to morning sun in particular is linked with better sleep quality, leading to better health.
https://pmc.ncbi.nlm.nih.gov/articles/PMC12502225/