As for the cause, it's a mixture of factors. "During physical exercise, the increased activity of the sympathetic nervous system ... redistributes blood flow from the splanchnic organs to the working muscles," one review suggests. "A severely reduced [blood flow to the abdominal gastrointestinal organs] may frequently cause GI [gastrointestinal] ischaemia [a condition, which causes the symptoms of diarrhea and abdominal pain, among others]".
On top of that, runners may find it difficult to control their anal sphincters while they work so hard with their other muscles.
“Someone in the middle of a strenuous physical activity, it’s really hard to voluntarily keep the muscle closed while engaging in other activities with other muscles in the legs and pelvis," colon and rectal surgeon with Novant Health in Charlotte, North Carolina Michael Dobson told Mental Floss. "You can’t control the muscle when using muscle.”