DNA testing

Can you do a DNA test while pregnant ? Or wait until baby is born