If you need to get an answer during pregnancy, the baby must be tested through amniocentesis, where some of the amniotic fluid is withdrawn from your uterus by a needle, or by chorionic villi sampling, also called CVS, in which a tiny bit of placenta is removed either by an abdominal needle or by a catheter placed up through your cervix. Amniocentesis can be done around 14 to 16 weeks of pregnancy, and CVS can be done as early as week nine. Each procedure has some risk of causing miscarriage, and amnio may be slightly safer for the baby than CVS, especially if your local doctors don't do many CVS procedures.
Your blood and your husband's blood also will need to be drawn for genetic testing. Paternity can be established with 99.999 percent certainty, unless the other possible father is related to you or your husband, in which case the test results may be less clear-cut.