Well, it's really hard to judge considered you didn't give all of the facts. Was he the presumed father before the DNA testing was done? And had he been ordered by the court to pay child support? I'm going to assume, for purposes of this answer, that the answer to both of those questions is yes.
If so, then he was imprisoned for violating a court order. It is irrelevant whether later DNA tests proved that he wasn't the father. Child support is meant to protect the child (it's best interests). So, for example, if a woman gives birth while she is married, then in the eyes of the court the husband is the presumed father. If they get divorced, the court will order child support. Failure to pay is a violation of the court order and is punishable by imprisonment. It may have been proved that he wasn't indeed to father, but that doesn't negate the fact that he violated a court order.
Yes, I think it stinks and it is unfair. But you have to consider that the judge and prosecutor were following the law. That doesn't make them bad people, just means they might have not exercised their discretion appropriately.