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)2D); the function of immune 1α-hydroxylase (CYP27B1) activity and metabolism of 25-hydroxyvitamin D (25(OH)D) beyond antigen-presenting cells; advances in immune cell target gene responses to 1,25-dihydroxyvitamin D (notably changes in metabolic profile). Whilst much of the interest during the COVID-19 era has focused on vitamin D and public health, the continued evolution of our understanding of how vitamin D interacts with different components of the immune system continues to support a beneficial role for vitamin D in immune health.