Surgery might be necessary if conservative treatments fail to relieve symptoms, or in cases of severe conditions like large ovarian cysts or extensive endometriosis. A gynecologist will assess the need for surgery based on the severity of symptoms and overall health.