Yevamos10: 2
נִסֵּת עַל פִּי בֵית דִּין — תֵּצֵא, וּפְטוּרָה מִן הַקָּרְבָּן. לֹא נִסֵּת עַל פִּי בֵית דִּין — תֵּצֵא, וְחַיֶּבֶת בַּקָּרְבָּן. יָפֶה כֹּחַ בֵּית דִּין, שֶׁפּוֹטְרָהּ מִן הַקָּרְבָּן. הוֹרוּהָ בֵית דִּין לִנָּשֵׂא, וְהָלְכָה וְקִלְקְלָה — חַיֶּבֶת בַּקָּרְבָּן, שֶׁלֹּא הִתִּירוּהָ אֶלָּא לִנָּשֵׂא.
If she married by the court's sanction, she must leave, but is exempt from the sacrifice. [If] she did not marry by the court's sanction, she must leave, and is obligated to [bring] the sacrifice; the power of the court is effective in exempting her from the sacrifice. [If] the court ruled that she may marry, and she went and acted immorally, she is obligated to [bring] the sacrifice, since they only permitted her to marry.
Yevamos10: 3
הָאִשָּׁה שֶׁהָלַךְ בַּעֲלָהּ וּבְנָהּ לִמְדִינַת הַיָּם, וּבָאוּ וְאָמְרוּ לָהּ ,,מֵת בַּעֲלִיךְ וְאַחַר כָּךְ מֵת בְּנֵךְ”, וְנִשֵּׂאת, וְאַחַר כָּךְ אָמְרוּ לָהּ ,,חִלּוּף הָיוּ הַדְּבָרִים” — תֵּצֵא, וְהַוָּלָד רִאשׁוֹן וְאַחֲרוֹן מַמְזֵר.  אָמְרוּ לָהּ ,,מֵת בְּנֵךְ וְאַחַר כָּךְ מֵת בַּעֲלִיךְ”, וְנִתְיַבְּמָה, וְאַחַר כָּךְ אָמְרוּ לָהּ ,,חִלּוּף הָיוּ הַדְּבָרִים” — תֵּצֵא, וְהַוָּלָד רִאשׁוֹן וְאַחֲרוֹן מַמְזֵר.  אָמְרוּ לָהּ ,,מֵת בַּעֲלִיךְ”, וְנִסֵּת, וְאַחַר כָּךְ אָמְרוּ לָהּ ,,קַיָּם הָיָה וָמֵת” — תֵּצֵא, וְהַוָּלָד רִאשׁוֹן מַמְזֵר, וְהָאַחֲרוֹן אֵינוֹ מַמְזֵר.  אָמְרוּ לָהּ ,,מֵת בַּעֲלִיךְ”, וְנִתְקַדְּשָׁה, וְאַחַר כָּךְ בָּא בַעֲלָהּ — מֻתֶּרֶת לַחֲזוֹר לוֹ. אַף עַל פִּי שֶׁנָּתַן לָהּ אַחֲרוֹן גֵּט, לֹא פְסָלָהּ מִן הַכְּהֻנָּה. אֶת זוֹ דָּרַשׁ רַבִּי אֶלְעָזָר בֶּן מַתְיָא: (ויקרא כא, ז) ,,וְאִשָּׁה גְּרוּשָׁה מֵאִישָׁהּ” — וְלֹא מֵאִישׁ שֶׁאֵינוֹ אִישָׁהּ.
A woman whose husband and son went overseas, and they came and told her, “Your husband died, and then your son,” and she married, and afterward they told her that the reverse had occurred —- she must leave [her husband], and any child [born] before or after is a mamzer.  [If] they told her, “Your son died, and then your husband,” and she underwent yibum, and afterward they told her that the reverse had occurred —- she must leave [her husband], and any child [born] before or after is a mamzer.  [If] they told her, “Your husband died,” and she married, and afterward they told her, “He was alive then but is now dead” —- she must leave [her husband], and any child [born] before is a mamzer, but [a child born] after is not a mamzer.  [If] they told her, “Your husband died,” and she was [then] betrothed, and then her husband reappeared —- she may return to him; even if the last one gave her a bill of divorce, he does not disqualify her from the priesthood. R' Elazar ben Masya expounded the following: “... a woman divorced from her husband ...” (Leviticus 21:7) but not [a woman divorced] from a man who is not her husband.