Causes of bowel problems
It may be that in MS, the colon muscles can become weak and sluggish and the gut slows down, so that the processing of waste takes longer and poo become harder and more difficult to pass, causing constipation.
Nerve damage in MS could mean that the body is unable to interpret sensations in the rectum and upper anal canal. MS might affect reflexes and voluntary control of muscles, where anal sphincter muscles may not relax properly or squeeze tightly enough when you need them to. Straining to open the bowels can be a cause of leakage as the anal muscles are weakened.
Medication can also cause constipation, and medication taken to ease constipation may cause loose poo which, in turn, could lead to bowel incontinence.
Other MS symptoms
Bladder problems might lead to a low fluid intake which could in turn cause bowel problems. Fatigue and mobility can limit exercise and activity levels which may also have an impact on the bowel.
Emotional and psychological factors might play a part - if going to the loo seems like too much of a struggle, you might not go. If you lose motivation or become depressed this can cause constipation.