Consuming more than 900ml of coffee daily could reduce the risk by almost one third (30%).
Multiple sclerosis affects more than 100,000 people in the UK. However it is not known what exactly causes it.
Researchers said the study paves the way for future research looking at how to prevent the health condition.
Multiple sclerosis is a condition which can affect the brain and spinal cord. It can cause problems with vision, arm or leg movement, sensation or balance.
In extreme cases, the chronic condition can cause serious disability, although it can also be mild.
According to the NHS, it's most commonly diagnosed in people in their 20s and 30s, although it can develop at any age. It's about two to three times more common in women than men.
The first was a Swedish study, which involved 1,620 adults with MS and a comparison group of 2,788 people without MS.
The second was a US study of 1,159 people with MS and 1,172 people without MS.
In both studies, people were asked about their coffee consumption and how long they had been drinking coffee for, the Press Association reports.
Researchers estimated coffee intake at and before the start of MS symptoms in those who developed the disease, and compared this with healthy groups.
The results showed that the risk of MS was consistently higher among people who drank fewer cups of coffee every day in both studies, even after taking into account other factors that might influence the results.
In the Swedish study, drinking coffee was linked to a lower risk of MS both at the start of symptoms and between five and 10 years beforehand.
Among those who drank more than six small cups (more than 900ml) every day, there was a 28-30% lower risk compared with non-coffee drinkers.
Similar results were found in the US study, with a 26-31% lower risk among those drinking more than 948ml daily at least five years beforehand and at the start of symptoms.
The authors wrote in the Journal of Neurology, Neurosurgery and Psychiatry that theirs was an observational study, so no firm conclusions could be drawn about cause and effect.
But they concluded: "Lower odds of MS with increasing consumption of coffee were observed, regardless of whether coffee consumption at disease onset or five or 10 years prior to disease onset was considered.
"In accordance with studies in animal models of MS, high consumption of coffee may decrease the risk of developing MS."
Dr Emma Gray, head of clinical trials at the MS Society, said: "This study provides new evidence that the link between the risk of developing MS and coffee consumption is worth exploring.
"There are more than 100,000 people with MS in the UK and we don’t yet fully understand what causes it.
"While more studies are needed in this area, we welcome any research that offers new insights into risk factors for MS."