Yevamos 4:1-2
Yevamos 4:1
Let’s say that a woman performs chalitzah with her brother-in-law and is later found to be pregnant. If she gives birth and the child is viable, then chalitzah was unnecessary. Accordingly, he may marry her relatives, she may marry his relatives and she may marry a kohein. If the child is not viable, then chalitzah was necessary, so he may not marry her relatives, she may not marry his relatives and she may not marry a kohein.
Yevamos 4:2
Let’s say that a man marries his widowed sister-in-law and she is found to be pregnant. If she gives birth and the child is viable, then he is not permitted to remain married to her (yibum was unnecessary and she is prohibited as his brother’s wife). If the child is not viable, they may remain married. If there is a doubt as to whether he or the deceased first husband is the father, they separate, the child is legitimate (regardless of who the father is), and the man and woman must bring a conditional guilt offering (because they do not know whether or not they committed a sin).