Ideally, pregnancy planning and preparation should be taken three months prior to conception, but it's permissible to start taking folic acid after you learn about the pregnancy. It's a water-soluble vitamin, and an overdose is practically impossible.
Folic acid is involved in DNA and RNA (custodians of genetic material) synthesis, which is especially important during fetal development. A folic acid deficiency can lead to defects in the neural tube (from which the brain and the spinal cord is formed) and other congenital malformations.
The recommended dose of folic acid before pregnancy is 0.4 mg per day.