Worldwide, ∼196 million are afflicted with endometriosis, a painful disease in which endometrial tissue implants and proliferates on abdominal peritoneal surfaces. Theories on the origin of endometriosis remained inconclusive. Whereas up to 90% of women experience retrograde menstruation, only 10% develop endometriosis, suggesting that factors that alter peritoneal environment might contribute to endometriosis. Herein, we report that whereas some gut bacteria promote endometriosis, others protect against endometriosis by fermenting fiber to produce short-chain fatty acids. Specifically, we found that altered gut microbiota drives endometriotic lesion growth and feces from mice with endometriosis contained less of short-chain fatty acid and n-butyrate than feces from mice without endometriosis. Treatment with n-butyrate reduced growth of both mouse endometriotic lesions and human endometriotic lesions in a pre-clinical mouse model. Mechanistic studies revealed that n-butyrate inhibited human endometriotic cell survival and lesion growth through G-protein–coupled receptors, histone deacetylases, and a GTPase activating protein, RAP1GAP. Our findings will enable future studies aimed at developing diagnostic tests, gut bacteria metabolites and treatment strategies, dietary supplements, n-butyrate analogs, or probiotics for endometriosis.