The rectum is a part of the gastrointestinal system .
The rectum shortens as material is forced into the anal canal and peristaltic waves propel the feces out of the rectum .