Background: There are no data available on the levels of genetic networks between obsessive–compulsive disorder (OCD) and multiple sclerosis (MS). To this point, we aimed to investigate common mechanisms and pathways using bioinformatics approaches to find novel genes that may be involved in the pathogenesis of OCD in MS. Methods: To obtain gene–gene interactions for MS and OCD, the STRING database was used. Cytoscape was then used to reconstruct and visualize graphs. Then, ToppGene and Enrichr were used to identify the main pathological processes and pathways involved in MS-OCD novel genes. Additionally, to predict transcription factors and microRNAs (miRNAs), the Enrichr database and miRDB database were used, respectively. Results: Our bioinformatics analysis showed that the signal transducer and the activator of transcription 3 (STAT3) and neurotrophic receptor tyrosine kinase 2 (NTRK2) genes had connections with 32 shared genes between MS and OCD. Furthermore, STAT3 and NTRK2 had the greatest enrichment parameters (i.e., molecular function, cellular components, and signaling pathways) among ten hub genes. Conclusions: To summarize, data from our bioinformatics analysis showed that there was a significant overlap in the genetic components of MS and OCD. The findings from this study make two contributions to future studies. First, predicted mechanisms related to STAT3 and NTRK2 in the context of MS and OCD can be investigated for pharmacological interventions. Second, predicted miRNAs related to STAT3 and NTRK2 can be tested as biomarkers in MS with OCD comorbidity. However, our study involved bioinformatics research; therefore, considerable experimental work (e.g., postmortem studies, case–control studies, and cohort studies) will need to be conducted to determine the etiology of OCD in MS from a mechanistic view.