This study explores the mechanisms of glucocorticoid-induced osteoporosis (OP) and Rheumatoid arthritis (RA), focusing on apoptosis and its role in the progression from RA to OP. Using microarray data from the GEO database, differential gene expression analysis was conducted with the limma package, identifying significant genes in RA and OP. Weighted Gene Co-expression Network Analysis (WGCNA) further examined gene relationships with the disease status, identifying co-expression patterns. Key genes were pinpointed by intersecting differentially expressed genes from RA and OP datasets with WGCNA module genes. Functional enrichment analysis using the "clusterProfiler" package focused on Gene Ontology and Kyoto Encyclopedia of Genes and Genomes pathways. Machine learning methods, including Lasso and Random Forest, refined the selection of key genes related to apoptosis. Immune infiltration analysis using CIBERSORT assessed immune cell differences between disease and normal samples. The study highlighted two crucial genes: ATXN2L and MMP14. These genes were identified through various analyses and found to be significantly associated with the progression of RA and OP. Gene Set Enrichment Analysis of ATXN2L and MMP14 revealed their involvement in specific biological processes and pathways. Correlation analysis between these key genes and immune cell infiltration showed significant associations. The ROC analysis evaluated the diagnostic performance of ATXN2L and MMP14, with miRNA regulatory networks related to these genes also predicted. In summary, this research provides valuable insights into the molecular mechanisms of RA and OP, emphasizing the importance of apoptosis and immune processes.