Autism spectrum disorder (ASD) refers to a group of neurodevelopmental disorders which include deficits in behavior, social interaction and communication. ASD has a complex genetic architecture, and it is also influenced by certain environmental exposures. Both types of predisposing factors may be related to immunological mechanisms, involving, for example, immune system genes and infections. Past studies have shown an association between infections occurring during the pregnancy in the mother and increased risk of ASD in the child, an observation which has received recent support from experimental animal studies of ASD-like behavior. The aim of this study was to study the genetic contribution to this effect. We employed genetic correlation analyses across potential ASD subtypes stratified on the basis of maternal pregnancy-related infections within the iPSYCH ASD case-cohort sample, as well as a case-case GWAS. We validated the trends of the genetic correlation analyses observed in our sample using GWAS summary statistics from the PGC ASD study (excluding iPSYCH). The genetic correlation between ASD with a history of maternal pregnancy-related infections and ASD without a history of maternal infections in iPSYCH was rg = 0.3811. We obtained a similar estimate between the former and the PGC ASD phenotype (rg = 0.3997). Both estimates are lower compared to the genetic correlation between ASD without a history of maternal infections and the PGC ASD phenotype (rg = 0.6735), and between ASD with a history of maternal infections occurring only more than 2 months following childbirth and the PGC ASD phenotype (rg = 0.6293). Additionally, we observed genetic variance between the two main ASD phenotypes using summary statistics from the case-case GWAS in iPSYCH (h2cc = 0.1059), indicating genome-wide differences between the phenotypes. Our results suggest potentially different etiologies of ASD based on a history of maternal pregnancy-related infections, which may, in part, be genetic. This highlights the relevance of maternal pregnancy-related infections to genetic studies of ASD and provides new insights into the molecular underpinnings of ASD.