Language:
كتاب النكاح
67  
Wedlock, Marriage (Nikaah)
(116)
Chapter: The going out of women for their needs
(115)
باب خُرُوجِ النِّسَاءِ لِحَوَائِجِهِنَّ
Sahih al-Bukhari 5237

Narrated `Aisha:

Once Sa`da bint Zam`a went out at night for some need, and `Umar saw her, and recognizing her, he said (to her), "By Allah, O Sa`da! You cannot hide yourself from us." So she returned to the Prophet (ﷺ) and mentioned that to him while he was sitting in my dwelling taking his supper and holding a bone covered with meat in his hand. Then the Divine Inspiration was revealed to him and when that state was over, he (the Prophet (ﷺ) was saying: "O women! You have been allowed by Allah to go out for your needs."

حَدَّثَنَا فَرْوَةُ بْنُ أَبِي الْمَغْرَاءِ، حَدَّثَنَا عَلِيُّ بْنُ مُسْهِرٍ، عَنْ هِشَامٍ، عَنْ أَبِيهِ، عَنْ عَائِشَةَ، قَالَتْ خَرَجَتْ سَوْدَةُ بِنْتُ زَمْعَةَ لَيْلاً فَرَآهَا عُمَرُ فَعَرَفَهَا فَقَالَ إِنَّكِ وَاللَّهِ يَا سَوْدَةُ مَا تَخْفَيْنَ عَلَيْنَا، فَرَجَعَتْ إِلَى النَّبِيِّ صلى الله عليه وسلم فَذَكَرَتْ ذَلِكَ لَهُ، وَهْوَ فِي حُجْرَتِي يَتَعَشَّى، وَإِنَّ فِي يَدِهِ لَعَرْقًا، فَأُنْزِلَ عَلَيْهِ فَرُفِعَ عَنْهُ وَهُوَ يَقُولُ ‏ "‏ قَدْ أَذِنَ لَكُنَّ أَنْ تَخْرُجْنَ لِحَوَائِجِكُنَّ ‏"‏‏.‏
Reference : Sahih al-Bukhari 5237
In-book reference : Book 67, Hadith 170
USC-MSA web (English) reference : Vol. 7, Book 62, Hadith 164
  (deprecated numbering scheme)