Protecting the kids I think, because if the dad is not known then the mother will have to pay for the child alone (subsidized by the government). In France around 3% of kids are raised from dads not knowing that they are not the biological father.
Personally I think this law is completely unfair but in practice I think the judges will not believe the one opposing the test.
You just can't order a test for someone else (your child) without their consent (so both parents, and a judge because parents don't have absolute rights over their children).
Courts order paternity tests just fine though when there is a reasonable doubt.
The people concerned can always refuse to be tested though.
Intuitively it seems to me this is the most counterproductive law ever as living with this doubt is the best way to destroy a family.