“When the rectum fills beyond a certain capacity,” Dr Bulsiewicz shares, “the rectal walls are stretched, triggering the defecation cycle. This begins with the rectoanal inhibitory reflex [RAIR], where the internal sphincter relaxes.”
Article source: https://www.huffingtonpost.co.uk/entry/poo-or-a-fart-heres-how-your-body-knows_uk_6405cfcee4b0e45e2f8f895d