The Prophet ﷺ would take the pledge of allegiance from women only by speaking this verse, "that they will not associate anything with Allah" [Mumtahanah 60:12]. She said, "The hand of the Messenger of Allah ﷺ never touched the hand of any woman except a woman whom he owned in marriage."
كان النبي ﷺ لا يبايع النساء بالكلام بهذه الآية {لا يشركن بالله شيئا} [الممتحنة: ١٢]. قالت: وما مست يد رسول الله ﷺ يد امرأة قط إلا امرأة يملكها.
Bukhari related it in the Book of Rulings (7214) from Mahmud, he said, Abdul-Razzaq related to us, Mamar informed us, from Zuhri, from Urwa, from Ayesha, and he mentioned it in this abridged form.Ibn Manda related it in the Book of Faith (493) through the route of Abdul-Razzaq, with his chain, in full detail, where it states, Ayesha, mother of the believers, said, "Fatimah bint Utba bin Rabia came to pledge allegiance to the Prophet ﷺ, so he took from her the pledge, "that they associate nothing with Allah" [Mumtahanah 60:12] and the rest of the verse." She said, "She placed her hand on her head out of shyness before the Messenger of Allah ﷺ, and the Messenger of Allah ﷺ was pleased with what he saw from her." So Ayesha said to her, "Confirm it, woman, for by Allah we did not pledge allegiance except on this basis." She said, "Yes, then." So he took her pledge according to the verse.Bukhari also related it (5288), and Muslim in the Book of Leadership (1866), through the route of Yunus bin Yazid, who said, Ibn Shihab said, Urwa bin Zubayr informed me that Ayesha, the wife of the Prophet ﷺ, said, "When believing women migrated to the Messenger of Allah ﷺ, they were tested according to the word of Allah , "O Prophet, when believing women come to you pledging allegiance to you that they will not associate anything with Allah, nor steal, nor commit fornication" [Mumtahanah 60:12]." Ayesha said, "So whoever among the believing women affirmed this had affirmed the test." This is the wording of Muslim.Bukhari added, "So when they affirmed that in their words, the Messenger of Allah ﷺ would say to them, 'Go, for I have accepted your pledge.' No, by Allah, the hand of the Messenger of Allah never touched the hand of any woman at all, rather he took their pledge only through speech. By Allah, the Messenger of Allah ﷺ took nothing from the women except what Allah commanded him. He would say to them, when he took the pledge from them, 'I have accepted your pledge,' in speech alone."