The rectum is located posterior to the vagina and uterus. This close anatomical relationship means that conditions affecting the rectum can have implications for gynecological health and vice versa. For example, a rectocele, which is a bulging of the rectum into the vagina, may cause significant discomfort and affect sexual function.