The puborectal sling is a pelvic muscle that wraps around the rectum in the shape of a sling. Its main purpose is to alert the brain that there is fecal matter in the rectum so that the person will know to use the restroom. The puborectal sling also forms the closest curve in the rectum to the anus, and can be felt during anal play.
People sometimes feel anxious about engaging in anal play because they worry they’ll feel the need to go to the bathroom, but really their puborectal sling is being pulled by the penis or toy in the rectum. The rectum does not hold fecal matter for long periods of time; it’s more like a passageway between the intestines and the anus. So, assuming good gastrointestinal health, it is unlikely that someone will truly need to poop during anal sex; it’s just the puborectal sling being pulled or stimulated.