All of our discussions in Massekhet Yevamot open with the premise that the brother who passed away had no children; if he did have children, the mitzva of yibum would never come into effect. The first Mishna in the fourth perek (35b) presents a situation where the widow is left pregnant. In such a case, we must wait and see whether the unborn child is viable. If she gives birth to a child who lives, there is no need for yibum; if the child does not survive, then the normal rule of yibum will apply.
And what would have to be done in case one of the surviving brothers performs yibum before the child is born? Here, too, the Mishna distinguishes between a case where the unborn child survives and a case where he or she does not. If the child survives, the yibum was a forbidden sexual act and the couple will need to bring sin-offerings (and, obviously, cannot continue living together). If the child does not survive, we learn retroactively that the act of yibum was appropriate and the couple can continue their married life together.
The Gemara on our daf quotes a baraita that presents the opinion of Rabbi Eliezer, who rules that in such a case the couple will need to divorce.
Although we do not follow the ruling of Rabbi Eliezer in this case, nevertheless his position deals with some of the basic issues of this topic, so the rishonim examined his statement closely in order to see the ramifications of his position.
Rashi understands that Rabbi Eliezer’s intention is to teach that in such a case the couple will need to separate, and the means to do it will be through a normal writ of divorce, with no need of halitza. Thus it appears that Rashi understands that the yibum was successful, but the man is punished for performing yibum at a time that the relationship may have been a forbidden one.
The Rambam, The Ri”d and others suggest that the requirement here is to have a geṭ in addition to the required halitza.
The Rashba has an alterative reading of Rabbi Eliezer’s statement that does not include the requirement to divorce her, just a ruling that they cannot continue living together (yotzi rather than yotzi b’geṭ), and he understands that Rabbi Eliezer requires only that halitza be performed.