Is paternity DNA testing while pregnant against the law?

Likely legal. Prenatal paternity testing is usually an optional test and would be done at the request of the patient and is not likely to be covered by insurance. It would require tissue samples from your fetus by an amniocentesis and from each prospective father (usually blood or buccal swab) - which would of course require the cooperation of the prospective fathers.
Depends. Any medical procedure requiring a sample would be considered battery if done without the permission of the patient. In 2017, you can determine paternity as early as 8-10 weeks by taking a sample of mothers blood, isolating fetal cells & comparing the DNA to that of the supposed father. This non invasive paternity procedure (NIPP) is usually not covered by insurance but is considered valid in court.
Test on whom? Test on an adult needs only an oral swab or a blood sample. If you are talking about testing the fetus, that would require amniotic fluid sampling and would be unethical to put the fetus at risk for a paternity test. It is possible that in the near future, testing fetal dna in maternal blood would make if feasible to test the fetus, without putting the fetus at risk. There no law against these.