Endometriosis is defined by the presence of endometrial cells outside of their normal location within the uterine cavity. Reflux of menstrual blood into the abdominal cavity and subsequent implantation of the endometrial cells in the abdominal cavity is the most widely accepted theory for the origin of endometriosis.
Endometriosis causes either pelvic painor infertility, or both. While a benign condition, the extent of pelvic involvement by endometriosis varies. The most common sites for endometriosis include the ovaries, where it can cause formation of cysts known as endometriomas.
Since women do not menstruate while pregnant and breastfeeding, there is no re-seeding of endometriosis implants during that time. In addition, the hormonal milieu of pregnancy, with very high levels of progesterone, further suppresses pre-existing endometerial disease.
Thus endometriosis and its associated symptoms of pelvic pain and infertility are indeed both prevented and alleviated by pregnancy. However, while endometriosis is dormant during pregnancy, once regular cycles resume, the symptoms may recur over time. Thus pregnancy does not "cure" endometriosis - it merely suppresses it.