Multiple sclerosis (MS) susceptibility is influenced by genetics; however, little is known about genetic determinants of disease expression. We aimed at assessing genetic factors influencing quantitative neuroimaging measures in two cohorts of progressive MS (PMS) and relapsing-remitting MS (RRMS) patients. Ninety-nine PMS and 214 RRMS patients underwent a 3-T brain magnetic resonance imaging (MRI) scan, with the measurement of five MRI metrics including T2 lesion volumes and measures of white matter, grey matter, deep grey matter, and hippocampal volumes. A candidate pathway strategy was adopted; gene set analysis was carried out to estimate cumulative contribution of genes to MRI phenotypes, adjusting for relevant confounders, followed by single nucleotide polymorphism (SNP) regression analysis. Seventeen Kyoto Encyclopedia of Genes and Genomes pathways and 42 Gene Ontology (GO) terms were tested. We additionally included in the analysis genes with enriched expression in brain cells. Gene set analysis revealed a differential pattern of association across the two cohorts, with processes related to sodium homeostasis being associated with grey matter volume in PMS (p=0.002), whereas inflammatory-related GO terms such as adaptive immune response and regulation of inflammatory response appeared to be associated with T2 lesion volume in RRMS (p=0.004 and p=0.008, respectively). As for SNPs, the rs7104613T mapping to SPON1 gene was associated with reduced deep grey matter volume (β=-0.731, p=3.2*10-7 ) in PMS, whereas we found evidence of association between white matter volume and rs740948A mapping to SEMA3A gene (β=22.04, p=5.5*10-6 ) in RRMS. Our data suggest a different pattern of associations between MRI metrics and functional processes across MS disease courses, suggesting different phenomena implicated in MS.