Once I was passing from place to place, and a certain old man met me. He said to him: Rabbi, why are the householders of Israel restrained from having children? I said to him: My son, because the Holy One, blessed be He, loves them with a complete love, and rejoices in them, and refines them, so that mercy may increase before Him. Go and learn from Abraham and Sarah, who were barren of Isaac for seventy-five years, and they increased mercy until Isaac came, and they rejoiced in him. Go and learn from Rebecca, who was barren for twenty years and increased mercy until Jacob came, and she rejoiced in him. Go and learn from Rachel, who was barren fourteen years from her [two] children, and increased mercy until both came, and she rejoiced in them. Go and learn from Hannah, who was barren nineteen years and six months until Samuel came, and she rejoiced in him.
Why God Withholds Children From the Righteous
Yalkut Shimoni on Nach 78:21
פעם אחת הייתי עובר ממקום למקום מצאני זקן אחד אמר לו רבי מפני מה בעלי בתים שבישראל נעצרים על הבנים מהיות להם, אמרתתי לו בני מפני שנהקב"ה אוהבן אהבה גמורה ושמח בהם ומצרפן כדי שירבו רחמים לפניו. צא ולמד מאברהם ושרה שהיו עקרים מיצחק חמשה ושבעים שנה והרבו רחמים עד שבא יצחק ושמחו בו. צא ולמד מרבקה שהיתתה עקרה עשרים שנה והרבתה רחמים עד שבא יעקב ושמחו בו. צא ולמד מרחל שהיתה עקרה ארבע עשרה שנים משני ילדיה והרבתה רחמים עד שבאו שנינם ושמחה בהם. צא ולמד מחנה שהיתה עקרה תשע עשרה שנה וששה חדשים עד שבא שמואל ושמחה בו: