The immune system is heavily involved in the pathophysiology (changes brought on by disease) of MS, but it’s not clear what provokes this response in the first place. Viral infections, genetics, and environmental factors have all been connected to MS in observational research. Extreme grief may also predispose people to the disease.
The high degree of immune involvement in MS and the fact that women are more prone to autoimmune diseases (and to MS) than men strongly suggests that MS is an autoimmune condition. This hasn’t been directly proven though; ideally, researchers would be able to identify a single self-antigen or autoreactive T cell that could cause disease in otherwise healthy lab animals. Although this has been possible with certain autoimmune diseases, such as myasthenia gravis and lupus, it is a very high standard, and it may be a long time before this can be done for MS.
It’s possible that a viral infection sets MS into motion. People who have Epstein-Barr virus antibodies in their blood (which suggests being previously infected with the virus) have about 4.5 times greater odds of developing MS than those who have not had the virus. Similarly, people with a history of infectious mononucleosis (typically caused by the Epstein-Barr virus) have about 2 times greater odds of developing MS than people who haven’t had mono. It’s worth noting, however, that about 90% of the world’s population tests positive for Epstein-Barr by age 35. If a risk factor is common, it’s easy to correlate it with many things (e.g., “drinking water” could be a risk factor for many diseases, because everyone with a given disease is likely to have drunk water).
There aren’t any single alleles (gene variations) known to cause MS. That being said, certain alleles in the genes that encode for human leukocyte antigens (HLAs) in the major histocompatibility complex (MHC, part of the genome that encodes for a variety of cell surface proteins that are used by the immune system to identify “self”) are associated with a considerable increase in risk of MS. Additionally, a number of genes outside the MHC are associated with small increases or decreases in risk. Individuals who have a first-degree family member with MS have an increased risk of developing the condition compared with people who have no immediate family history of MS. In a study conducted in Denmark, for example, first-degree relatives of someone with MS had about a 7 times increased risk of developing it over their lifetime. Interestingly, spouses did not have any increased risk; the authors suggest that this rules out environmental factors, but it’s probably more correct to say that without certain genetic factors present, environmental factors aren’t likely to have a strong effect on whether the disease manifests.
Women have an increased risk of developing MS compared with men, a relative risk that has been increasing. Currently, women are at about 3 times the risk of developing MS as men. It’s not clear why this is, but some speculations include:
Women are having children less often and later in life; previous pregnancy and number of children have both been associated with a lower risk of MS in observational research.
Women have much stronger T helper 1 (Th1) immune responses than men. Given that MS is characterized by a high level of Th1 activation, it’s possible that women’s predisposition for MS is due to a sex-specific difference in immune system activity.
There is some observational evidence that vitamin D protects against the development and progression of MS, as well as MS-related disability . High serum levels of vitamin D are associated with a lower risk of MS, and both supplemental vitamin D and sun exposure (which increases vitamin D) show the same trend. Furthermore, a Mendelian randomization trial found that, as the number of alleles associated with low vitamin D in four genes increases, so does the risk of MS. Many of the studies that evaluate vitamin D have a high risk of bias, however, and shouldn’t be considered strong evidence of this relationship.
An important caveat to these findings is that a large amount of this research has been conducted in predominantly white countries, such as Australia and the Scandinavian countries. A study in the U.S. found that, among non-Hispanic white people, higher serum levels of vitamin D were associated with a lower risk of developing MS, but this relationship wasn’t present in the Black or Hispanic study participants.  Given that the degree of skin pigmentation is associated with lower levels of vitamin D, this weakens the evidence that vitamin D is somehow a cause of MS in all people. Additionally, supplementing with vitamin D in people with MS hasn’t seemed to improve the condition in clinical trials.
There is strong observational evidence that smoking increases the risk of MS by 20–60%, depending on the amount someone smokes. It’s possible that this increase in risk is related to the vascular or immune effects of smoking, and/or the general toxicity of compounds found in cigarette smoke. 
The prevalence of MS varies considerably across countries: regions in North America and Europe can have a prevalence of over 100 cases per 100,000 people, while regions in East Asia and sub-Saharan Africa have approximately 2 per 100,000 people.