Abu Hurairah reported,

The Prophet ﷺ sent a cavalry unit toward Najd, and they returned with a man from the tribe of Banu Hanifa called Thumama bin Uthal. They tied him to one of the pillars of the mosque.The Prophet ﷺ came out to him and said, "Release Thumama."He went to a grove of palm trees near the mosque, performed a full bath, then entered the mosque and declared, "I bear witness that there is no god but Allah, and that Muhammad is the Messenger of Allah."

Azami 1503

Sahih

عن أبي هريرة قال

بعث النبي ﷺ خيلا قبل نجد، فجاءت برجل من بني حنيفة يقال له: ثمامة بن أثال، فربطوه بسارية من سواري المسجد، فخرج إليه النبي ﷺ فقال: أطلقوا ثمامة. فانطلق إلى نخل قريب من المسجد فاغتسل، ثم دخل المسجد فقال: أشهد أن لا إله إلا الله، وأن محمدا رسول الله.

الأعظمي 1503صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Ghusl
Section
Bathing of a disbeliever when he accepts Islam
Numbering
Jami al-Kamil 1503 (2nd edition)
Azami 1503