A comprehensive global study published in 2017 on respiratory infections would say yes:
A new global collaborative study has confirmed that vitamin D supplementation can help protect against acute respiratory infections. The study, a participant data meta-analysis of 25 randomized controlled trials including more than 11,000 participants, has been published online in The BMJ.
“Most people understand that vitamin D is critical for bone and muscle health,” said Carlos Camargo of the Department of Emergency Medicine at Massachusetts General Hospital (MGH), the study’s senior author. “Our analysis has also found that it helps the body fight acute respiratory infection, which is responsible for millions of deaths globally each year.”
Additionally, a professor of respiratory infection and immunity at Queen Mary University of London had this to say about vitamin D:
“Vitamin D could almost be thought of as a designer drug for helping the body to handle viral respiratory infections,” he said. “It boosts the ability of cells to kill and resist viruses and simultaneously dampens down harmful inflammation, which is one of the big problems with Covid.”
The pharmaceutical industry obviously can’t make enormous profits from vitamin D, and that’s part of why it hasn’t been explored more as a protective mechanism. With all the benefits of vitamin D and the lack of downsides to it however, it is worth getting enough vitamin D (through sufficient sunlight exposure and a good diet) to protect against respiratory infections such as the flu and COVID-19.