(ו) וַיִּקַּ֧ח יְהוּדָ֛ה אִשָּׁ֖ה לְעֵ֣ר בְּכוֹר֑וֹ וּשְׁמָ֖הּ תָּמָֽר׃ (ז) וַיְהִ֗י עֵ֚ר בְּכ֣וֹר יְהוּדָ֔ה רַ֖ע בְּעֵינֵ֣י ה' וַיְמִתֵ֖הוּ ה'׃ (ח) וַיֹּ֤אמֶר יְהוּדָה֙ לְאוֹנָ֔ן בֹּ֛א אֶל־אֵ֥שֶׁת אָחִ֖יךָ וְיַבֵּ֣ם אֹתָ֑הּ וְהָקֵ֥ם זֶ֖רַע לְאָחִֽיךָ׃ (ט) וַיֵּ֣דַע אוֹנָ֔ן כִּ֛י לֹּ֥א ל֖וֹ יִהְיֶ֣ה הַזָּ֑רַע וְהָיָ֞ה אִם־בָּ֨א אֶל־אֵ֤שֶׁת אָחִיו֙ וְשִׁחֵ֣ת אַ֔רְצָה לְבִלְתִּ֥י נְתָן־זֶ֖רַע לְאָחִֽיו׃ (י) וַיֵּ֛רַע בְּעֵינֵ֥י ה' אֲשֶׁ֣ר עָשָׂ֑ה וַיָּ֖מֶת גַּם־אֹתֽוֹ׃ (יא) וַיֹּ֣אמֶר יְהוּדָה֩ לְתָמָ֨ר כַּלָּת֜וֹ שְׁבִ֧י אַלְמָנָ֣ה בֵית־אָבִ֗יךְ עַד־יִגְדַּל֙ שֵׁלָ֣ה בְנִ֔י כִּ֣י אָמַ֔ר פֶּן־יָמ֥וּת גַּם־ה֖וּא כְּאֶחָ֑יו וַתֵּ֣לֶךְ תָּמָ֔ר וַתֵּ֖שֶׁב בֵּ֥ית אָבִֽיהָ׃ (יב) וַיִּרְבּוּ֙ הַיָּמִ֔ים וַתָּ֖מָת בַּת־שׁ֣וּעַ אֵֽשֶׁת־יְהוּדָ֑ה וַיִּנָּ֣חֶם יְהוּדָ֗ה וַיַּ֜עַל עַל־גֹּֽזֲזֵ֤י צֹאנוֹ֙ ה֗וּא וְחִירָ֛ה רֵעֵ֥הוּ הָעֲדֻלָּמִ֖י תִּמְנָֽתָה׃ (יג) וַיֻּגַּ֥ד לְתָמָ֖ר לֵאמֹ֑ר הִנֵּ֥ה חָמִ֛יךְ עֹלֶ֥ה תִמְנָ֖תָה לָגֹ֥ז צֹאנֽוֹ׃ (יד) וַתָּסַר֩ בִּגְדֵ֨י אַלְמְנוּתָ֜הּ מֵֽעָלֶ֗יהָ וַתְּכַ֤ס בַּצָּעִיף֙ וַתִּתְעַלָּ֔ף וַתֵּ֙שֶׁב֙ בְּפֶ֣תַח עֵינַ֔יִם אֲשֶׁ֖ר עַל־דֶּ֣רֶךְ תִּמְנָ֑תָה כִּ֤י רָאֲתָה֙ כִּֽי־גָדַ֣ל שֵׁלָ֔ה וְהִ֕וא לֹֽא־נִתְּנָ֥ה ל֖וֹ לְאִשָּֽׁה׃ (טו) וַיִּרְאֶ֣הָ יְהוּדָ֔ה וַֽיַּחְשְׁבֶ֖הָ לְזוֹנָ֑ה כִּ֥י כִסְּתָ֖ה פָּנֶֽיהָ׃ (טז) וַיֵּ֨ט אֵלֶ֜יהָ אֶל־הַדֶּ֗רֶךְ וַיֹּ֙אמֶר֙ הָֽבָה־נָּא֙ אָב֣וֹא אֵלַ֔יִךְ כִּ֚י לֹ֣א יָדַ֔ע כִּ֥י כַלָּת֖וֹ הִ֑וא וַתֹּ֙אמֶר֙ מַה־תִּתֶּן־לִּ֔י כִּ֥י תָב֖וֹא אֵלָֽי׃ (יז) וַיֹּ֕אמֶר אָנֹכִ֛י אֲשַׁלַּ֥ח גְּדִֽי־עִזִּ֖ים מִן־הַצֹּ֑אן וַתֹּ֕אמֶר אִם־תִּתֵּ֥ן עֵרָב֖וֹן עַ֥ד שָׁלְחֶֽךָ׃ (יח) וַיֹּ֗אמֶר מָ֣ה הָֽעֵרָבוֹן֮ אֲשֶׁ֣ר אֶתֶּן־לָּךְ֒ וַתֹּ֗אמֶר חֹתָֽמְךָ֙ וּפְתִילֶ֔ךָ וּמַטְּךָ֖ אֲשֶׁ֣ר בְּיָדֶ֑ךָ וַיִּתֶּן־לָּ֛הּ וַיָּבֹ֥א אֵלֶ֖יהָ וַתַּ֥הַר לֽוֹ׃ (יט) וַתָּ֣קָם וַתֵּ֔לֶךְ וַתָּ֥סַר צְעִיפָ֖הּ מֵעָלֶ֑יהָ וַתִּלְבַּ֖שׁ בִּגְדֵ֥י אַלְמְנוּתָֽהּ׃
(6) Judah got a wife for Er his first-born; her name was Tamar. (7) But Er, Judah’s first-born, was displeasing to the LORD, and the LORD took his life. (8) Then Judah said to Onan, “Join with your brother’s wife and do your duty by her as a brother-in-law, and provide offspring for your brother.” (9) But Onan, knowing that the seed would not count as his, let it go to waste whenever he joined with his brother’s wife, so as not to provide offspring for his brother. (10) What he did was displeasing to the LORD, and He took his life also. (11) Then Judah said to his daughter-in-law Tamar, “Stay as a widow in your father’s house until my son Shelah grows up”—for he thought, “He too might die like his brothers.” So Tamar went to live in her father’s house. (12) A long time afterward, Shua’s daughter, the wife of Judah, died. When his period of mourning was over, Judah went up to Timnah to his sheepshearers, together with his friend Hirah the Adullamite. (13) And Tamar was told, “Your father-in-law is coming up to Timnah for the sheepshearing.” (14) So she took off her widow’s garb, covered her face with a veil, and, wrapping herself up, sat down at the entrance to Enaim, which is on the road to Timnah; for she saw that Shelah was grown up, yet she had not been given to him as wife. (15) When Judah saw her, he took her for a harlot; for she had covered her face. (16) So he turned aside to her by the road and said, “Here, let me sleep with you”—for he did not know that she was his daughter-in-law. “What,” she asked, “will you pay for sleeping with me?” (17) He replied, “I will send a kid from my flock.” But she said, “You must leave a pledge until you have sent it.” (18) And he said, “What pledge shall I give you?” She replied, “Your seal and cord, and the staff which you carry.” So he gave them to her and slept with her, and she conceived by him. (19) Then she went on her way. She took off her veil and again put on her widow’s garb.
ואמר עולא תמר זנתה וזימרי זינה תמר זנתה יצאו ממנה מלכים ונביאים זימרי זינה נפלו כמה רבבות מישראל אמר רב נחמן בר יצחק גדולה עבירה לשמה ממצוה שלא לשמה
§ And Ulla says: Tamar engaged in licentiousness with Judah (see Genesis, chapter 38), and Zimri engaged in licentiousness with Cozbi (see Numbers 25:6–9). Tamar engaged in licentiousness, and kings and prophets emerged from her. Zimri engaged in licentiousness, and tens of thousands from the Jewish people fell. Rav Naḥman bar Yitzḥak says: A transgression performed for the sake of Heaven is greater than a mitzva performed not for its own sake
(כ) וַיִּשְׁלַ֨ח יְהוּדָ֜ה אֶת־גְּדִ֣י הָֽעִזִּ֗ים בְּיַד֙ רֵעֵ֣הוּ הָֽעֲדֻלָּמִ֔י לָקַ֥חַת הָעֵרָב֖וֹן מִיַּ֣ד הָאִשָּׁ֑ה וְלֹ֖א מְצָאָֽהּ׃ (כא) וַיִּשְׁאַ֞ל אֶת־אַנְשֵׁ֤י מְקֹמָהּ֙ לֵאמֹ֔ר אַיֵּ֧ה הַקְּדֵשָׁ֛ה הִ֥וא בָעֵינַ֖יִם עַל־הַדָּ֑רֶךְ וַיֹּ֣אמְר֔וּ לֹא־הָיְתָ֥ה בָזֶ֖ה קְדֵשָֽׁה׃ (כב) וַיָּ֙שָׁב֙ אֶל־יְהוּדָ֔ה וַיֹּ֖אמֶר לֹ֣א מְצָאתִ֑יהָ וְגַ֨ם אַנְשֵׁ֤י הַמָּקוֹם֙ אָֽמְר֔וּ לֹא־הָיְתָ֥ה בָזֶ֖ה קְדֵשָֽׁה׃ (כג) וַיֹּ֤אמֶר יְהוּדָה֙ תִּֽקַּֽח־לָ֔הּ פֶּ֖ן נִהְיֶ֣ה לָב֑וּז הִנֵּ֤ה שָׁלַ֙חְתִּי֙ הַגְּדִ֣י הַזֶּ֔ה וְאַתָּ֖ה לֹ֥א מְצָאתָֽהּ׃ (כד) וַיְהִ֣י ׀ כְּמִשְׁלֹ֣שׁ חֳדָשִׁ֗ים וַיֻּגַּ֨ד לִֽיהוּדָ֤ה לֵֽאמֹר֙ זָֽנְתָה֙ תָּמָ֣ר כַּלָּתֶ֔ךָ וְגַ֛ם הִנֵּ֥ה הָרָ֖ה לִזְנוּנִ֑ים וַיֹּ֣אמֶר יְהוּדָ֔ה הוֹצִיא֖וּהָ וְתִשָּׂרֵֽף׃ (כה) הִ֣וא מוּצֵ֗את וְהִ֨יא שָׁלְחָ֤ה אֶל־חָמִ֙יהָ֙ לֵאמֹ֔ר לְאִישׁ֙ אֲשֶׁר־אֵ֣לֶּה לּ֔וֹ אָנֹכִ֖י הָרָ֑ה וַתֹּ֙אמֶר֙ הַכֶּר־נָ֔א לְמִ֞י הַחֹתֶ֧מֶת וְהַפְּתִילִ֛ים וְהַמַּטֶּ֖ה הָאֵֽלֶּה׃׃
(20) Judah sent the kid by his friend the Adullamite, to redeem the pledge from the woman; but he could not find her. (21) He inquired of the people of that town, “Where is the cult prostitute, the one at Enaim, by the road?” But they said, “There has been no prostitute here.” (22) So he returned to Judah and said, “I could not find her; moreover, the townspeople said: There has been no prostitute here.” (23) Judah said, “Let her keep them, lest we become a laughingstock. I did send her this kid, but you did not find her.” (24) About three months later, Judah was told, “Your daughter-in-law Tamar has played the harlot; in fact, she is with child by harlotry.” “Bring her out,” said Judah, “and let her be burned.” (25) As she was being brought out, she sent this message to her father-in-law, “I am with child by the man to whom these belong.” And she added, “Examine these: whose seal and cord and staff are these?”
(א) היא מוצאת והיא שלחה שלא נפל לבה מהשתדל לזכות את עצמה אע''פ שהיו מוציאים אותה להשרף כי היה לבה כלב הארי: (ב) לאיש אשר אלה לו אע''פ שהיתה באותה סכנה לא רצתה להלבין פניו
(1) היא מוצאת והיא שלחה, even at this late stage in the trial when she was already on the way to the site of her execution, Tamar did not despair, as she had a heart as stout as that of a lion. Even though she was in extreme danger she did not want to publicly embarrass Yehudah.
(טו) ואם אחד סיפר עליו מעשים רעים: אם אמת הדבר, לא יחפש לעוות האמת לנקות עצמו, כמו שאמר יהודה "צדקה ממני" (בראשית לח כו); ואל ישתדל להכחיש אותו האיש שסיפר עליו, ואל ישנאהו על שגילה הדבר, אך ייכנע לבורא ברוך הוא אשר גילה מעט מהרבה לייסרו ולהוכיחו כדי שישוב אליו.
(15) In the case where somebody told evil tales concerning him — if these are true — he should not seek to twist the truth and thus clear himself, but do as Judah who said: "She is more in the right than I" (Gen. 38:26). And he should not try to contradict the man that told these tales, nor should he hate him because he revealed the matter, but he should bow humbly before the Creator, Blessed be He, that he has revealed a little of much that could have been revealed, in order to rebuke him and correct him that he might return to God.
How is it that such a story of Yehudah and Tamar ended in David HaMelech? Keep in mind the Gemara in Horayos earlier.