Polycystic ovary syndrome (PCOS) is a complex endocrine metabolic disorder that affects 5–10% of women of reproductive age. The endometrium of women with PCOS has altered immune cells resulting in chronic low-grade inflammation, which attribute to recurrent implantation failure (RIF). In this study, we obtained three PCOS and RIF datasets respectively from the Gene Expression Omnibus (GEO) database. By analyzing differentially expressed genes (DEGs) and module genes using weighted gene co-expression networks (WGCNA), functional enrichment analysis, and three machine learning algorithms, we identified twelve diseases shared genes, and two diagnostic genes, including GLIPR1 and MAMLD1. PCOS and RIF validation datasets were assessed using the receiver operating characteristic (ROC) curve, and ideal area under the curve (AUC) values were obtained for each disease. Besides, we collected granulosa cells from healthy and PCOS infertile women, and endometrial tissues of healthy and RIF patients. RT-PCR was used to validate the reliability of GLIPR1 and MAMLD1. Furthermore, we performed gene set enrichment analysis (GSEA) and immune infiltration to explore the underlying mechanism of PCOS and RIF cooccurrence. Through the functional enrichment of twelve shared genes and two diagnostic genes, we found that both PCOS and RIF patients had disturbances in metabolites related to the TCA cycle, which eventually led to the massive activation of immune cells.