Here is how it's possible to get ovarian cancer even after having your ovaries removed.
Total hysterectomy with salpingo-oophorectomy procedure removes your cervix and uterus as well as both ovaries and fallopian tubes.
This makes ovarian cancer less likely to occur, but it does not remove all risk.
You still have a small risk of what's called primary peritoneal cancer, cancer which develops in the thin layer of tissue that lines the abdomen, uterus, bladder and rectum
The cancer may result from ovarian cells that migrated to the peritoneal area (a thin layer of tissue that lines the abdomen) during each menstrual cycle before your ovaries were removed.
These cells can become cancerous later on.
Alternatively, since the peritoneum and ovaries arise from the same tissues during when an embryo develops, it's possible that cancer could arise from the cells of the lining of the abdominal cavity.
Source: Mayo Clinic