"When Judah saw her, he thought her to be a harlot, because she had covered her face" (Genesis 38:15). But Rabbi Yochanan said: She had covered her face the whole time she was in her father-in-law's house, and therefore he did not recognize her. From here our Rabbis said: A man must be acquainted with his daughter-in-law. Judah said: This is a harlot; what concern of mine is she? And he went on his way. Once he had gone on his way, she lifted her eyes to the Holy One, blessed be He, and said before Him: Master of the Universe, shall I go out empty from the body of this righteous man? Immediately the Holy One, blessed be He, sent Michael and brought him back. From where do we know this? For here it is written, "So he turned aside to her" (Genesis 38:16), and there it is written, "And the she-donkey saw the angel of the Lord… and the she-donkey turned aside" (Numbers 22:23). "And he said to her, Come now…" (Genesis 38:16). Why? "Because he did not know that she was his daughter-in-law." "And he said, I will send you a kid of the goats" (Genesis 38:17). He said to her: What pledge shall I give you? "And she said, Your signet…" (Genesis 38:18). "And he came to her, and she conceived" (Genesis 38:18). Scripture lacks nothing of them. And what is "she conceived by him"? Rather, that she gave birth to kings like him. "And it came to pass about three months later…" (Genesis 38:24). Rabbi Yehudah HaLevi son of Rabbi Shalom said: At three months a woman is recognizable, whether she is pregnant or not.
Why an Angel Turned Judah Back to Tamar in Tanchuma
Midrash Tanchuma Buber, Vayeshev 17:5
ויראה יהודה ויחשבה לזונה כי כסתה פניה, אלא אמר ר' יוחנן שכסתה פניה עד שהיא בבית חמיה, מכאן אמרו רבותינו, צריך אדם להיות מכיר כלתו, אמר יהודה זו היא זונה, מה איכפת לי בה, הלך לו, כיון שהלך לו תלתה עיניה להקב"ה, אמרה לפניו רבונו של עולם, אני יוצאה חנם מגופו של צדיק זה, מיד שלח הקב"ה מיכאל והחזירו, מנין שכאן כתוב ויט אליה, וכתיב התם ותרא האתון את מלאך ה' וגו' ותט האתון (במדבר כב כג). ויאמר אליה הבה נא וגו'. למה כי לא ידע כי כלתו היא, ויאמר אנכי אשלח גדי עזים, אמר לה מה הערבון אשר אתן לך, ותאמר חותמך וגו'. ויבא אליה ותהר, לא חסר המקרא כלם, ומהו ותהר לו, אלא שילדה מלכים כיוצא בו. ויהי כמשלש חדשים וגו'. אמר ר' יהודה הלוי ב"ר שלום בת ג' חדשים אשה נכרת אם מעוברת אם לאו.