Yevamos2: 8
מִצְוָה בַגָּדוֹל לְיַבֵּם; וְאִם קָדַם הַקָּטָן — זָכָה.  הַנִּטְעָן עַל הַשִּׁפְחָה וְנִשְׁתַּחְרְרָה, אוֹ עַל הַנָּכְרִית וְנִתְגַּיְּרָה — הֲרֵי זֶה לֹא יִכְנוֹס; וְאִם כָּנַס — אֵין מוֹצִיאִין מִיָּדוֹ.  הַנִּטְעָן עַל אֵשֶׁת אִישׁ, וְהוֹצִיאוּהָ מִתַּחַת יָדוֹ — אַף עַל פִּי שֶׁכָּנַס, יוֹצִיא.
The commandment is for the eldest to perform yibum; but if the youngest anticipated [him], he gains [it].  One who is suspected in connection with a slavewoman, and she was [then] freed, or in connection with a non-Jewish woman, and she [then] converted —- may not marry [her]; but if he did marry [her], we do not force him to divorce [her].  One who is suspected in connection with another man's wife and they compelled him to divorce her, even if he married [her], he must divorce [her].