The interaction between vitamin D and the immune system is perhaps the most well recognised extraskeletal facet of vitamin D, encompassing early studies of therapy for TB and leprosy through to more recent links with autoimmune disease. However, the spotlight on vitamin D and immune function has been particularly intense in the last five years following the COVID-19 pandemic. This was due, in part, to the many association studies of vitamin D status and COVID-19 infection and disease prognosis, as well as the smaller number of clinical trials of vitamin D supplementation. However, a potential role for vitamin D in COVID-19 also stemmed from the basic biology of vitamin D that provides a plausible mechanistic rationale for beneficial effects of vitamin D for improved immune health in the setting of respiratory infection. The aim of this review is to summarise the different strands of mechanistic evidence supporting a beneficial effect of vitamin D in COVID-19, how this was modified during the pandemic itself, and the potential new aspects of vitamin D and immune function that are likely to arise in the near future. Key topics that feature in this review are: antibacterial versus antiviral innate immune responses to 1,25-dihydroxyvitamin D (1,25(OH)