I assume it will be harmful to the baby if a woman smokes while pregnant. How about the situation where the woman smokes, gets pregnant and then stops? Does the smoking in the period until the pregnancy affect the baby? How long before a pregnancy does a woman need to quit smoking in order to insulate the baby from the negative effects of smoking?
While most studies appear to be on women who quit during pregnancy, I found a study that compared pregnancy outcomes in women who never smoked, quit smoking before pregnancy, quit smoking in early pregnancy, and those that smoked during pregnancy. It found
maternal smoking cessation before or during early pregnancy appears to result in appropriate fetal and childhood growth
The whole study Active and passive maternal smoking during pregnancy and the risks of low birthweight and preterm birth: the Generation R Study is available on the internet and I recommend reading it in full and also looking at the references. The differences in birth weight between the babies born to women who quit before and during early pregnancy were not significant.
Another study in 7000 women in the Netherlands also found no difference between women who didn't smoke and women who quit before 18 weeks of pregnancy.
For all active smoking categories in early pregnancy, quitting smoking was associated with a higher birthweight than continuing to smoke. Tendencies towards smaller non-significant beneficial effects on mean birthweight were found for reducing the number of cigarettes without quitting completely. This study shows that active and passive smoking in late pregnancy are associated with adverse effects on weight and gestational age at birth. Smoking in early pregnancy only, seems not to affect fetal growth adversely.
Note that for all of these studies, just reducing the number of cigarettes per day is counted as continuing to smoke.