Autism spectrum disorders (ASD) can be caused by environmental factors. These factors act early in the development of the nervous system and induce stereotyped repetitive behaviors and diminished social interactions, among other outcomes. Little is known about how these behaviors are produced. In pregnant women, delivery of valproic acid (VPA) (to control seizure activity or stabilize mood) or immune activation by a virus increases the incidence of ASD in offspring. We found that either VPA or Poly Inosine:Cytosine (which mimics a viral infection), administered at mouse embryonic day 12.5, induced a neurotransmitter switch from GABA to glutamate in PV- and CCK-expressing interneurons in the medial prefrontal cortex by postnatal day 10. The switch was present for only a brief period during early postnatal development, observed in male and female mice at postnatal day 21 and reversed in both males and females by postnatal day 30. At postnatal day 90, male mice exhibited stereotyped repetitive behaviors and diminished social interaction while female mice exhibited only stereotyped repetitive behavior. Transfecting GAD1 in PV- and CCK-expressing interneurons at postnatal day 10, to reintroduce GABA expression, overrode the switch and prevented expression of autistic-like behavior. These findings point to an important role of neurotransmitter switching in mediating the environmental causes of autism.