Using Mendelian Randomization (MR) and large-scale Genome-Wide Association Study (GWAS) data, this study aimed to investigate the potential causative relationship between testosterone and sex hormone-binding globulin (SHBG) levels and the onset of several cancers, including pathway enrichment analyses of single nucleotide polymorphisms (SNPs) associated with cancer allowed for a comprehensive bioinformatics approach, which offered a deeper biological understanding of these relationships. The results indicated that increased testosterone levels in women were associated with a higher risk of breast and cervical cancers but a lower risk of ovarian cancer. Conversely, increased testosterone was linked to lower stomach cancer risk for men, whereas high SHBG levels were related to decreased risks of breast and prostate cancers. The corresponding genes of the identified SNPs, as revealed by pathway enrichment analysis, were involved in significant metabolic and proliferative pathways. These findings emphasize the need for further research into the biological mechanisms behind these associations, paving the way for potential targeted interventions in preventing and treating these cancers.