Relying on the bonds of matrimony to prove patrilineal descent really never made a lot of sense. It essentially relies on the honesty of an awful lot of people who may have good reason to hide an illicit affair.
In this day and age, you'd think that such notions would have fallen by the wayside -- now that paternity is easy to prove with a simple DNA test. Unfortunately, the law hasn't exactly caught up with the times. The law simply -- if irrationally -- presumes that if a couple is married, the husband is the father of the wife's child. The legal term for the husband is actually that of a "presumptive father." That presumption has, no doubt, been responsible for many cases of paternity fraud throughout history -- but are men stuck under the same bonds today?
It can depend a lot on where the child is born and what judge is hearing the case -- even if a DNA test conclusively proves that you are not a child's biological father. There have been cases where men have been held legally liable for child support over children that could not be their own biological children, simply because they were married to the mother at the time of the child's conception or birth.
In Michigan, for example, the Paternity Act gives the fathers of children born to someone else's wife no rights to the child, presumably in an attempt to preserve the family unit above all else. However, it also puts the burden of supporting that child on the woman's husband -- whether he wants it or not. It should be noted that Michigan isn't alone in enforcing such archaic laws.
Generally speaking, the courts try to justify such actions based on the child's best interests -- which means that there may be some hope for a man stuck in this situation. If the biological father is in a financial position to provide for his child, the court might allow a DNA test to prevail and let the right man take financial responsibility. Getting out from under a case of paternity fraud is no easy task -- and you may want to employ the help of an attorney well-versed in paternity actions and father's rights cases to assist you with the matter.
Source: The child support hustle, "Paternity fraud after marriage," N.K. Clark, accessed Sep. 29, 2017