Yevamot 35 - The widow who is pregnant
If one's brother died childless, there is a bond of the remaining brother to the widow, so he must either do a yibum (which serves as marriage) or a chalitzah (akin to divorce). However, since the widow may be pregnant, the Sages established that neither yibum nor chalitzah can be done for ninety days after the brother died.
If the brother violated this decree and performed chalitzah earlier, and then it was found out that the widow was pregnant - which means that the brother did not die childless -- then the chalitzah was meaningless. As a result, he is still allowed to marry the widow's relatives - because he was never connected to her in any sense. Likewise, she is permitted to marry his relatives: a valid chalitzah is considered as a divorce, thus forbidding her to marry his relatives, but this chalitzah is considered as nothing. She is not a divorcee in any sense and can even marry a Kohen.
However, if the brother hurried to do a yibum but found that his brother's wife was already pregnant with a child, then he was not allowed to do a yibum, because it does not apply in the presence of a child. Since he transgressed a prohibition of marrying his brother's wife in the situation when this is forbidden, they have to separate, and bring a sacrifice. However, if they later find out that the child was not viable, the marriage can continue.
Art: A Widow by James Jacques Joseph Tissot