NAS occurs when a pregnant woman uses addictive drugs, including prescription opioids, heroin, and methadone. These substances pass through the placenta, and the fetus becomes dependent on them. After birth, the newborn is suddenly cut off from the drug supply, leading to withdrawal symptoms.