Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:20:40

˹And We favored you˺ when your sister went and said, 'Shall I direct you to someone who will be responsible for him?' So We restored you to your mother that she might be content and not grieve. And you killed someone, but We saved you from retaliation and tried you with a ˹severe˺ trial. And you remained ˹some˺ years among the people of Madyan. Then you came ˹here˺ at the decreed time, O Moses.  

When (idh, for explanation) your sister, Maryam, walked up, to obtain news of you, for they had brought wet nurses ˹for you˺ but you would not take to the breast of any of them, and she then said, “Shall I show you someone who will take care of him?”. Her offer was accepted and so she brought ˹them˺ his mother and he took to her breasts. Thus We restored you to your mother that her eyes might rejoice, in seeing you again, and not grieve, at that point ˹anymore˺. Then you slew a soul, namely, the Copt in Egypt — and you became distressed for having slain him because of ˹how˺ Pharaoh ˹would react˺; whereupon We delivered you from ˹great˺ distress, and We tried you with various ordeals, We tested you by landing you in some other ˹ordeal˺ and ˹again˺ delivered you from it. Then you stayed for several years, ten ˹years˺, among the people of Midian, after you had reached it having left Egypt, ˹staying˺ with the prophet Shu‘ayb and marrying his daughter. Then you came ˹hither˺ as ordained, in My knowledge, with the Message ˹that you will deliver˺ — and this was when you were forty years old, O Moses!
القرآن:٢٠:٤٠

إِذْ تَمْشِي أُخْتُكَ فَتَقُولُ هَلْ أَدُلُّكُمْ عَلَىٰ مَنْ يَكْفُلُهُ ۖ فَرَجَعْنَاكَ إِلَىٰ أُمِّكَ كَيْ تَقَرَّ عَيْنُهَا وَلَا تَحْزَنَ ۚ وَقَتَلْتَ نَفْسًا فَنَجَّيْنَاكَ مِنَ الْغَمِّ وَفَتَنَّاكَ فُتُونًا ۚ فَلَبِثْتَ سِنِينَ فِي أَهْلِ مَدْيَنَ ثُمَّ جِئْتَ عَلَىٰ قَدَرٍ يَا مُوسَىٰ  

{إذ} للتعليل {تمشي أختك} مريم لتتعرف من خبرك وقد أحضروا مراضع وأنت لا تقبل ثدي واحدة منهن {فتقول هل أدلكم على من يكفله} فأجيبت فجاءت بأمه فقبل ثديها {فرجعناك إلى أمك كي تقر عينها} بلقائك {ولا تحزن} حينئذ {وقتلت نفسا} هو القبطي بمصر، فاغتممت لقتله من جهة فرعون {فنجيناك من الغم وفتناك فتونا} اختبرناك بالإيقاع في غير ذلك وخلصناك منه {فلبثت سنين} عشرا {في أهل مدين} بعد مجيئك إليها من مصر عند شعيب النبي وتزوجك بابنته {ثم جئت على قدر} في علمي بالرسالة وهو أربعون سنة من عمرك {يا موسى}.