Magnesium CAN cause diarrhea.
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. 
Dietary Reference Intakes for Calcium, Phosphorus, Magnesium, Vitamin D, and …
By Standing Committee on the Scientific Evaluation of Dietary Reference Intakes, Food and Nutrition Board, Institute of Medicine
1997. National Academy of Sciences. Print
National Digestive Diseases Information Clearing House
Your Digestive System and How It Works
 Colorado State University
Pathophysiology of Diarrhea
 American Cancer Society
 Mayo Medical Laboratories
 National Digestive Diseases Information Clearing House
 The American Journal of Emergency Medicine; Joo Suk O
Paradoxical Hypomagnesemia Caused by Excessive Ingestion of Magnesium Hydroxide
2008; Volume: 26; No: 7; Pages: 837
Glossary of Terms
Bile: a fluid that is made and released by the liver and stored in the gallbladder.
Hyperosmotic: Of, relating to, or characterized by increased osmosis.
The American Heritage Medical Dictionary
Pancreatic Enzymes: natural chemicals that help break down fats, proteins and carbohydrates.
Pancreatic Cancer Action Network
Paradox: having seemingly contradictory qualities or phases.
Saline: Of, relating to, or containing salt; salty.
“Signs of excess magnesium can be very subtle and can occur with long-term use of magnesium supplements and laxatives. The symptoms can be similar to magnesium deficiency and include: changes in mental status, nausea, diarrhea, loss of appetite, muscle weakness, difficulty breathing, extremely low blood pressure, and irregular heartbeat.”
Magnesium Warnings and Contraindications Dr. Sircus.com