Rabbi Shmuel bar Nachman said in the name of Rabbi Yonatan: For what reason did Mordechai and Esther merit that this miracle be performed through them? Because of the wife of Shimi, the mother of their father, who saved two righteous men from being killed. And these are they: Achimaatz and Yonatan. At the time when the servants of Avshalom pursued after them, they ran and entered the house of Shimi. What did that righteous woman do? She brought them inside the well, and she uncovered herself and sat upon the mouth of the well, in order to save the two righteous men from death. When the servants of Avshalom entered and saw her, that she was uncovered, they turned back. They said: Is it possible that two righteous men are hidden inside the well and an esteemed woman such as this is uncovered over them? From where do you derive that it is so? As it is written, "And the woman took and spread the covering over the face of the well, and strewed ground grain upon it" (II Samuel 17:19). What is the meaning of "and strewed ground grain upon it"? That she made herself loathsome and disgraced herself in order to save the two righteous men from death. The Holy One, blessed be He, said to her: Since you have disgraced yourself for the sake of these two righteous men, I will bring forth from you two righteous ones who will stand in the breaches of Israel, and for their sake I will save Israel from being killed.
How the Wife of Shimi Saved Two Righteous Men in a Well
Midrash Shmuel 32:4
אמר רבי שמואל בר נחמן אמר רבי יונתן מפני מה זכו מרדכי ואסתר (לעשות) [להעשות] נס זה על ידם, מפני אשתו של שמעי אם אביהם שהצילה שני צדיקים מן ההריגה, ואלו הן אחימעץ ויונתן, בשעה שרדפו עבדי אבשלום אחריהם, רצו והכניסו לביתו של שמעי, מה עשתה אותה הצדקת הכניסה אותם בתוך הבאר, ופירעה את עצמה וישבה על פי הבאר, כדי שתציל את שני הצדיקים מן המיתה, כיון שנכנסו עבדי אבשלום וראו אותה שהוא מפורעת, חזרו לאחוריהם, אמרו איפשר שני צדיקים חבויין בתוך הבאר ואשה חשובה כזו מפורעת עליהם, מנא לך דהכי כתיב, ותקח האשה ותפרוש את המסך על (פי) [פני] הבאר ותשטח עליו הריפות (שמואל ב' י"ז י"ט), מהו ותשטח עליו הריפות, שהירפה וניוולה את עצמה כדי שתציל את שני הצדיקים מן המיתה, אמר לה הקדוש ברוך הוא הואיל וביזיתה את עצמך על שני הצדיקים הללו אני אוציא ממך שני צדיקים שיעמדו בפרצותיהן של ישראל, ובשבילן אני מציל את ישראל מן ההריגה.