Magnesium is one of those critical minerals that take part in of hundreds of processes in the human body. It is essential for good health.
It is true you can get some from foods, and that might be enough for some people. It would seem in the past we would acquire a lot from our drinking water and bathing water (absorbed through the skin), but domestic water supplies filter out most of the magnesium. And modern agriculture has depleted a great deal more from the soil, so vegetables and fruits no longer have the quantities enjoyed by our ancestors.
A multi vitamin will usually not contain magnesium or if it does it will be a tiny amount. Magnesium is very bulky and will not fit in those tiny multi-vit pills.
Many people do not easily absorb magnesium well and for them a supplement would be ideal. An easy sign of deficiency is if you suffer from cramps, especially leg cramps often during the night. Also constipation is a sign of magnesium deficiency.
Magnesium is a muscle relaxant, and hence the relief from muscle cramps. It is also plays a critical osmotic role in moving fluids into the bowels and keeping stools soft and hence avoids constipation, assuming you are adequately hydrated.
Magnesium is not usually found on its own and is usually bound to something else, so supplements would normally come as magnesium oxide or magnesium citrate. The citrate version seems to have the best bio absorption rate.
Magnesium is very cheap. In hospitals it is given often to those with heart conditions and most doctors seem to know its benefits well. Not much profit for drug companies of course so you won't see its benefits advertised.
RDA is about 400mg/day, which for most is on the very low side. An 800mg dose or 1.5g would be better. Higher doses cause loose stools, so one reason magnesium is a main ingredient in many laxatives.