Excessive gestational weight gain (GWG) has been associated with autism spectrum disorder (ASD). This study sought to examine whether familial susceptibility for autism, intensity of ASD-related behaviors, or prepregnancy BMI influences the association of GWG with ASD-related behaviors. Using data from the Early Autism Risk Longitudinal Investigation (EARLI) study (n = 136), a familial enriched cohort of mothers who had a previous child with ASD, and the Health Outcomes and Measures of the Environment (HOME) study (n = 253), a general population cohort, gestational age and prepregnancy BMI category-specific GWG z scores were calculated. Caregivers completed the Social Responsiveness Scale (SRS) to assess the presence and severity of ASD-related traits in children aged 3 to 8 years. Using quantile regression, the association between GWG z scores and ASD-related behaviors in children was estimated. In HOME, among mothers who had overweight or obesity prepregnancy BMI values, GWG z scores and SRS scores were positively associated in children with more ASD-related traits (higher SRS scores), but not in children with fewer ASD-related traits. Similar patterns were observed in EARLI among mothers with prepregnancy obesity. GWG may be associated with autism-related behaviors among children who have a greater predisposition to these behaviors and who have mothers with prepregnancy overweight or obesity.