Waail bin Hajar reported,

A woman went out during the time of the Messenger of Allah ﷺ intending to pray, when a man met her, covered her, and forced himself upon her. She cried out, but he fled.Then a man passed by her, and she said, "That man did such and such to me."A group of the Muhajirun passed by, and she said to them, "That man did such and such to me."They went off and seized the man whom she thought had assaulted her and brought him to her. She said, "Yes, this is the one."So they brought him to the Messenger of Allah ﷺ. When he ordered that the man be stoned, the actual assailant stood up and said, "Messenger of Allah, I am the one who did it."The Messenger of Allah ﷺ then said to her, "Go, for Allah has forgiven you," and he spoke kindly to the man who had been wrongly accused. To the man who had committed the act, he said, "Stone him."He also said, "He has repented such a Tawba that if the people of Madinah repented likewise, it would be accepted from them."

Tirmidhi 1453

Daif

حدثنا محمد بن يحيى النيسابوري حدثنا محمد بن يوسف عن إسرائيل حدثنا سماك بن حرب

عن علقمة بن وائل الكندي عن أبيه

أن امرأة خرجت على عهد رسول الله ﷺ تريد الصلاة فتلقاها رجل فتجللها فقضى حاجته منها فصاحت فانطلق ومر عليها رجل فقالت إن ذاك الرجل فعل بي كذا وكذا ومرت بعصابة من المهاجرين فقالت إن ذاك الرجل فعل بي كذا وكذا فانطلقوا فأخذوا الرجل الذي ظنت أنه وقع عليها وأتوها فقالت نعم هو هذا فأتوا به رسول الله ﷺ فلما أمر به ليرجم قام صاحبها الذي وقع عليها فقال يا رسول الله أنا صاحبها فقال لها اذهبي فقد غفر الله لك وقال للرجل قولا حسنا وقال للرجل الذي وقع عليها ارجموه وقال لقد تاب توبة لو تابها أهل المدينة لقبل منهم

الترمذي 1453ضعيف
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Legal punishments
Chapter
Woman if she is forced into adultery
Numbering
Darussalam 1453
Tirmidhi 1453