Fetal valproate syndrome (FVS) is now a well-known risk of using valproic acid in pregnancy. It is characterised by physical and intellectual developmental problems in the fetus, primarily with language and communication.
Teratogenicity
The general term for a drug that causes adverse developmental effects on a fetus is a teratogen. It is thought that the teratogenicity of valproic acid is due to its action on folate (folic acid) metabolism. The risk of FVS is greatest when it is used in the first trimester of pregnancy.
The drug is also known to increase the risk of neural tube defects like spina bifida and also autism spectrum disorder (Christensen et al, 2013). Overlap of symptoms between FVS and ASD can complicate diagnosis.
Medical uses
Despite its teratogenicity in pregnancy, valproic acid is widely used as an effective anti-epileptic drug and mood stabiliser.
Use in autism spectrum disorder
To answer your question, the teratogenic effect in pregnancy does not mean that people with ASD (or other groups of people) should not use valproic acid. They may be prescribed it for epilepsy or as a mood stabiliser.
A study by Hollander et al (2010) shows the efficacy of valproic acid for the treatment of symptoms of irritability in people with autism spectrum disorder.
See this excellent answer for an in-depth analysis of current research on the causes of autism.