Rectal prolapse occurs when the rectum, the last section of the large intestine, slides out of the anus.