(1) About that time Judah left his brothers and camped near a certain Adullamite whose name was Chirah. (2) There Judah saw the daughter of a certain Canaanite whose name was Shua, and he married her and cohabited with her. (3) She conceived and bore a son, and he named him Er. (4) She conceived again and bore a son, and named him Onan. (5) Once again she bore a son, and named him Shelah; he was at Cheziv when she bore him. (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 Eternal, and the Eternal 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 Eternal, and God 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. (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?” (26) Judah recognised them, and said, “She is more in the right than I, inasmuch as I did not give her to my son Shelah.” And he was not intimate with her again. (27) When the time came for her to give birth, there were twins in her womb! (28) While she was in labor, one of them put out his hand, and the midwife tied a crimson thread on that hand, to signify: This one came out first. (29) But just then he drew back his hand, and out came his brother; and she said, “What a breach you have made for yourself!” So he was named Peretz. (30) Afterward his brother came out, on whose hand was the crimson thread; he was named Zerach.
AT THIS TIME. This is not the time that Yosef was sold, rather this was prior to his sale. We see the same occurrence relating to when the tribe of Levi were separated. Why then is the story of Yehuda placed in the middle of the story of the sale of Yosef (if Yehuda's story was much earlier)? To separate the story of his sale to the story of Potiphar's wife. I am obliged to explain this becuase from the day that Yosef was sold until the day that the entire family descended to Egypt was 22 years. Onan was born and he was Yehuda's second child, he had his own children which makes him at least 12 years old. Furthermore, Tamar was pregnant and gave birth to Peretz who descended to Egypt and had two sons. Don't question about Betzalel's heritage as I address that elsewhere.
ואין ספק שהיה ראוי לחבר אחרי מכירת יוסף ויוסף הורד מצרימה אלא שראתה התורה להפסיק עם ספור יהודה לסבות. ראשונה להגיד שב' התחלות היו למלכי ישראל ומלכי יהודה כי יוסף היה התחלה למלכי ישראל בשני בניו אפרים ומנשה שילדה לו המצרית ולכן היה מלכותם בלתי אמתי וישר. ויהודה היה התחלה למלכי יהודה שהיו ושיהיו בימות מלך המשיח משני בניו שילדה לו תמר כי היא היתה הגונה לצאת ממנה מלכים קדושים מפאת שלמותה ואם מפאת היותה בתו של שם כדבריהם ז"ל לכן היה מלכות מאת י"י קודש ומתמיד לעד. ושנית להודיע צדקת יהודה שנפרד מאת אחיו בעבור מה שראה מאכזריותם על יוסף להרגו עד שעם כמה מחוזק ההשתדלו' הצילו מיד' במכירתו למרי' וג"כ שלא יוכל לראות ברעה אשר מצא את אביו ואבלו וצערו ועם היות שנפרד מהם הנה לא עזב את אביו מלעבדו כי תמי' היה יהודה בן עובד את אביו עד שהיה בימי הרעב הולך עם אחיו לשבור שבר במצרים לבית הזקן כמו שיראה מן הספורים שיבואו בפרשת ויהי מקץ כי עם היותו נבדל מאחיו הנה תמיד היה חוזר על בית אביו לעשות צרכיו ולעבדו בכל לבבו.
ABARBANEL: There is no doubt that it would be more suitable to connect the aftermath of the sale of Joseph to his descent to Egypt but the Torah had to disrupt with the story of Yehuda for several reasons. Firstly, to say that these were two beginnings: One was for the kings of Israel and the other for the kings of Yehuda. Yosef was the beginning of the kings of Yisrael with his sons Ephraim and Menace that were born to an Egyptian mother. Therefore, their lineage was not entirely truthful and honest. Yehuda was the beginning of the kings of Judah who were and will also be in the time of Mashiah from the two sons that Tamar gave birth to. She was suitable to be the mother of holy kings because of her wholesomeness since she was the daughter of Shem as told by the Rabbis. Therefore, this was the kingship from God and will be eternal. The second reason was to inform the righteousness of Yehuda who was separated from his brothers because of what he saw in their cruelty towards killing Yosef. He tried with great efforts to save him by offering to sell him instead. Furthermore, he couldn't see his father suffer and mourn over Yosef. If Yehuda was separated from his brothers, he was not from his father. Yehuda was always working for his dad until there was a famine and he went with his brothers to gather food from Egypt to bring to his father's house. Yehuda is separate from his brothers as he was always with his father to help with his needs and to serve him with all of his heart.
“After these events did King Ahasuerus promote Haman” (Esther 3:1). Rava said: Only after the Holy Blessed One created a remedy for the blow. As Reish Lakish said: The Holy Blessed One does not strike at the Jewish people unless God has already created a remedy for them beforehand, as it is stated: “When I would have healed Israel, then the iniquity of Ephraim was uncovered” (Hosea 7:1). ...