Yes,but. Dna testing can be done on the fetus in utero, but the tests have risks.Chorionic villus sampling or amniocentesis involve needles inserted to gain samples. The process has the risk of triggering a miscarriage , infection or worse to mom and baby. There are medical reasons for these procedures under specific circumstances & these can be discussed with the ob.
Expensive/some risks. Fetal dna testing currently requires an amniocentesis (with the inherent risks) to obtain a sample of fetal cells. The procedue, as well as the dna tests, can be expensive - but if there are medical indications for the tests, your insurance may cover most (or all) of the expense. There likely will eventually be the ability to perform fetal dna analyses by extracting fetal dna from maternal blood.