As soon as they can swab the inside of the baby's mouth is the first time paternity testing can be done WITHOUT risk.
It can be done with Amniocentesis or CVS (depending on how far along the mother is) but that carries a risk of miscarriage, injury to mother and/or fetus, and honestly I cannot think of a time when knowing paternity would be so important that it would overtake that particular risk.
here's a website about paternity testing:
http://www.paternitytesthelp.org/prenatalpaternitytesting.html that's where I got my information about in utero testing.
at 1:14 PM on Jul. 26, 2010