Being continent (able to hold in one’s stool and not leak) involves several factors. It requires an intact, strong anal sphincter muscle, functioning nerves that control the anal sphincter muscles. Any process that damages the anal sphincter muscles or the nerves can cause incontinence. Aging can affect continence because as one grows older, the anal muscle bulk and strength decreases.
In addition, stool consistency plays a part as well. Imagine your hand holding onto a tennis ball and your other hand holding onto some water. It is easier to control the tennis ball and not let it slip out of your hands when compared to water. Similarly, it is easier for the anal sphincter muscle hold on to solid stool, rather than liquid stool. The rectum is also involved for continence. When stool presents at the rectum, the rectum then relaxes and then accommodates (stores) the stool until it is time to poop. Rectums that are stiff will not be able to do that and hence the person would have to run to the bathroom (urgency) every time the stool presents at the rectum.