During defecation, the circular muscles of the rectal wall undergo a wave of contraction to push feces toward the anus. As feces emerge from the anus, the longitudinal muscles of the rectum and levator ani bring the anal canal back up, the feces are expelled, and the anus and rectum return to their normal positions.