No. A DNA test can be performed at any age even before the child is born.
As long as DNA can be obtained and there is a collecting of DNA process in place, there are no age restrictions. A DNA mouth swab, commonly called buccal swabs, can be collected as soon as the baby is born.
If the child is unborn, we can collect DNA belonging to the fetus through the mother’s blood which is the least invasive way. Or DNA can be collected from the fetus through an amniocentesis or CVS medical procedure which are invasive to the mother and the unborn child.