A woman from the tribe of Juhayna came to the Messenger of Allah ﷺ and said, "I have committed adultery, and I am pregnant."He handed her over to her guardian and said, "Treat her well, and when she gives birth, bring her to me."When she delivered her child, the guardian brought her back. The Prophet ﷺ gave the order, her clothes were tied securely around her, and she was stoned. He then performed the funeral prayer over her.Umar said to him, "Are you praying over her when she has committed adultery?"He replied, "She has made such a sincere repentance that if it were divided among seventy people of Madinah, it would be enough for them all. Have you ever found a better repentance than that she gave her life willingly for the sake of Allah ?"
أخبرنا إسمعيل بن مسعود قال حدثنا خالد قال حدثنا هشام عن يحيى بن أبي كثير عن أبي قلابة عن أبي المهلب
أن امرأة من جهينة أتت رسول الله ﷺ فقالت إني زنيت وهي حبلى فدفعها إلى وليها فقال أحسن إليها فإذا وضعت فأتني بها فلما وضعت جاء بها فأمر بها فشكت عليها ثيابها ثم رجمها ثم صلى عليها فقال له عمر أتصلي عليها وقد زنت فقال لقد تابت توبة لو قسمت بين سبعين من أهل المدينة لوسعتهم وهل وجدت توبة أفضل من أن جادت بنفسها لله عز وجل
Muslim narrated it in the Hudud, chapter, "One who confesses against himself to zina," hadith 1696, from the hadith of Hisham Dastawai, transmitted this way. It is also found in Kubra, hadith 2084. Khalid is Ibn Harith.