More Info: Upset stomach and diarrhea are common symptoms of a magnesium overdose. A magnesium overdose will not occur from diet alone, but can occur with ingesting too much milk of magnesia, Epsom salts, supplementation, or any laxative or antacid containing high amounts of magnesium.
Does Dietary Magnesium Cause Diarrhea?
Magnesium from the diet is absorbed more efficiently than pharmacological magnesium and has not been shown to be a cause of diarrhea, even when consumed in excess. On the other hand, one of the primary symptoms of excessive intake of pharmacological magnesium is diarrhea, which may be accompanied by abdominal cramping and nausea. 
How the Small Intestines Work
When the digestive system is functioning normally, the contents of the stomach enter the small intestines where pancreatic enzymes and bile are introduced from the pancreas and the liver to further break down the food and dissolve fats. The digested food can then be absorbed through the small intestine. 
What Happens in the Body When You Get Diarrhea?
Diarrhea can be caused by such things as bacteria, viruses, medications, and medical conditions. Diarrhea is categorized based on the cause and includes secretory, osmotic, motility-related, and inflammatory and infectious.
Secretory diarrhea occurs when too much water enters the intestines when it isn’t needed.
Osmotic diarrhea occurs when something inside the intestines pulls too much water into the intestines from the body.
Motility-related diarrhea occurs when food is pushed through the intestines too fast.
Inflammatory and Infectious diarrhea occurs with damage to the mucosal lining, which decrease fluids and inhibits food absorption.
Magnesium causes osmotic diarrhea. 
Why Pharmacological Magnesium Causes Diarrhea
To understand how magnesium works in the intestines, a look at magnesium citrate provides a good example. Magnesium citrate is a hyperosmotic saline laxative used to treat constipation. It works to pull water into the small intestines, which in turn stimulates the movement within the intestines. When too much is ingested, too much water is drawn into the intestine causing osmotic diarrhea. 
How to Know if Diarrhea is Caused by Magnesium
There are tests that your doctor can perform to diagnose whether chronic diarrhea is caused by excessive magnesium intake. A stool culture, testing samples of a watery stool, can indicate magnesium levels, which are not normally present. 
When to See a Doctor
Whether or not your diarrhea is caused by magnesium or another source, you should see your physician if you notice any signs of dehydration, have severe pain in the abdomen or rectum, have a fever that is greater than 102 degrees, have stools containing blood or pus, have stools that are black and tarry, or have diarrhea for more than 2 days. Children should see a doctor is if they have diarrhea for more than 24 hours. 
The Magnesium Diarrhea Paradox
Interestingly, if a person attempts to manage a magnesium deficiency with supplementation, taken in excess the supplementation can cause diarrhea, which if severe enough, can cause a magnesium deficiency. Most supplements taken in excess can result in sometimes very serious side effects, which is why they should be recommended by a physician following measurements of deficiency.