The corpus luteum is a temporary endocrine structure in the female ovaries that plays a crucial role in the menstrual cycle and early pregnancy. It forms from the remnants of the ovarian follicle after ovulation, specifically from the Graafian follicle, which releases the mature egg.