The legal presumption of the legitimacy of children born during marriage is based on experience and public policy. The old rule arose from the recognition at common law that the courts were unable to make consistent and factually correct rulings in such cases and that the legal process and the doubts that it stirred up were often destructive to marriages and children. Notably, under the terms of even the old rule, in cases when courts and the public could be certain that the husband was not the father, such as with sailors away at sea, the husband could get a ruling against paternity.
The better case to make is that children where a valuable commodity at the time and the male spouse had full control over them. He could send them away or keep them. This law stripped the bio dad of any rights. Now of course a father cannot simply punt a child to an orphanage.
The PBS show has a storyline and scene about Ross Poldark learning that another man is going to raise his son and Poldark could do nothing about it.