One theory for this association is that there are common risk factors for endometriosis and ovarian cancer to co-occur. The other is that endometrial cells that have spread from the uterus
to the ovary can transform into cancer cells via gene mutation. However, it is generally thought that endometriosis is not a direct precursor to cancer.
Answer assisted by Ben Ferguson, Medical Student