It is written, "And it shall come to pass in the latter days that the mountain of the house of the LORD shall be established" (Isaiah 2:2). This is what Scripture says, "Though your beginning was small, your end shall greatly increase" (Job 8:7) — to teach you that everyone who is in distress at his beginning has ease at his end. And you have no one who was in greater distress than Abraham, who was cast into the fiery furnace, and was exiled from his father's house, and sixteen kings pursued him, and he was tested with ten trials, and he buried Sarah; yet in the end he had ease, "And Abraham was old, advanced in days, and the LORD had blessed Abraham in all things" (Genesis 24:1). Isaac was distressed in his youth, and the Philistines envied him, as it is said, "And Abimelech said to Isaac, Go from us, for you have become much mightier than we" (Genesis 26:16); in the end they sought favor from him, as it is said, "And Isaac said to them, Why have you come to me?" (Genesis 26:27). And Jacob was distressed in his youth, as it is said, "Greatly have they distressed me from my youth, let Israel now say" (Psalms 129:2). While he was yet in his mother's womb, Esau sought to kill him, as it is said, "And the children struggled together within her" (Genesis 25:22). And when he received the blessings, Esau hated Jacob, and "Esau said in his heart" (Genesis 27:41). And he fled to Laban and was distressed over his daughter, and afterward Laban sought to kill him, as it is said, "An Aramean sought to destroy my father" (Deuteronomy 26:5). He departed from him and encountered Esau, as it is said, "And Jacob lifted up his eyes and looked, and behold, Esau was coming" (Genesis 33:1). Upon him came the distress of Dinah and the distress of Joseph; yet in the end he had ease, as it is said, "And Joseph sustained his father" (Genesis 47:12). Thus, "Though your beginning was small, your end shall greatly increase."
Why the Patriarchs Suffered First and Found Rest at the End
Midrash Tanchuma Buber, Eikev 5:1
כתיב והיה באחרית הימים נכון יהיה הר בית ה' וגו' (ישעיה ב ב), זש"ה והיה ראשיתך מצער וגו' (איוב ח ז), ללמדך שכל המצטער מתחילתו נוח לו בסופו ואין לך שמצטער יותר מאברהם, שהושלך בכבשן האש, וגלה מבית אביו, ורדפו אחריו ששה עשה מלכים, ונתנסה בעשר נסיונות, וקבר את שרה, ולבסוף נחה, ואברהם זקן בא בימים וה' ברך וגו' (בראשית כד א). יצחק נצטער בנערותו, ויקנאו בו פלשתים, שנאמר] ויאמר אבימלך אל יצחק לך מעמנו כי עצמת ממנו מאד (שם כו טז), לסוף בקשו ממנו [שנאמר] ויאמר אליהם יצחק (למה) [מדוע] באתם אלי וגו' (שם שם כז). ויעקב נצטער בנערותו, שנאמר רבת צררוני מנעורי יאמר נא ישראל (תהלים קכט ב), עד שהוא במעי אמו ביקש עשו להורגו, שנאמר ויתרוצצו הבנים בקרבה וגו' (בראשית כה כב), [וכשקיבל הברכות, וישטום עשו את יעקב וגו'] ויאמר עשו בלבו וגו' (שם כז מא), וברח ללבן ונצטער בבתו, ואחר כך ביקש לבן להורגו, שנאמר ארמי אובד אבי (דברים כו ה), יצא מאצלו ופגע בעשו, שנאמר וישא יעקב (את) עיניו וירא והנה עשו בא וגו' (בראשית לג א), באתה עליו צרת דינה, וצרת יוסף, ולבסוף נחה, [שנאמר] ויכלכל יוסף את אביו וגו' (שם מזי ב), הוי והיה ראשיתך מצער וגו'.