In Pennsylvania, there is something known as a presumption of paternity when referring to a child that is born to a married couple. Under this presumption, the law assumes that a child born or conceived during an intact marriage is a child of that marriage. This means that husband and wife are presumed to be mom and dad. This presumption is very strong and extremely difficult to overcome.
This presumption came about as a way to protect intact marriages and the family unit as a whole. Therefore this presumption may not apply where there is no intact marriage to protect. Although this is a very strong presumption, it is also a rebuttable one in two distinct situations.
One way to rebut this presumption is to prove sterility on the part of the father. This could be shown if the father was born sterile, or even if he had a procedure to make him sterile before the child could have possibly been conceived. The second way to rebut this presumption is to prove lack of access. This usually must be more than just sleeping in different beds. For example, if the husband spends a whole year in a different country and does not make a trip home to visit the wife, then the wife becomes pregnant at some point during this year, father may be able to rebut the presumption of paternity.
If a married couple has a child, and continues to function as a family unit, a third party is not allowed to attack the marriage by claiming to be the father of the child. The presumption favors the intact marriage over a third party claim that would harm the marriage in any way.