A new study published in Fertility and Sterility  found that lifestyle factors prior to pregnancy strongly influence fertility outcomes. Specifically:
- Caffeine consumption (coffee, tea, sodas, etc.) in both men and women was associated with an over 70% increase in the risk of pregnancy loss.
- Maternal age of 35 or greater doubled the risk of pregnancy loss.
- Regular use of a prenatal multivitamin cut the risk of miscarriage in half.
In this study the detrimental effects on average occurred at 2 cups of caffeine per day, however other studies have found increased miscarriage rates at very low levels of caffeine intake . Those avoiding caffeine completely were significantly less likely to have a miscarriage.
Caffeine not only increases miscarriage rates, it has also been associated with reduced fertility rates. A study published in the British Journal of Pharmacology  found that caffeine inhibited muscular activity in the fallopian tubes, which reduces the chances of successful implantation.
As for decaf, at least one study found an increased risk of miscarriage for decaf coffee, so that may not be a very good solution .
In conclusion, avoid coffee, caffeine and aging … and be sure to take a good quality prenatal.
 See, e.g., https://www.ncbi.nlm.nih.gov/pubmed/26329421
 https://www.sciencedaily.com/releases/2011/05/110523121142.htm / RE Dixon, SJ Hwang, FC Britton, KM Sanders, SM Ward. Inhibitory effect of caffeine on pacemaker activity in the oviduct is mediated by cAMP-regulated conductances. British Journal of Pharmacology, 2011; 163 (4): 745 DOI: 10.1111/j.1476-5381.2011.01266.x