It was narrated from Ibn Umar that:
The Messenger of Allah (ﷺ) said:" Do not prevent the female slaves of Allah from praying in the mosque." A son of his said: We will indeed prevent them!" He got very angry and said: "I tell you a Hadith from the Messenger of Allah (ﷺ) and you say, we will indeed prevent them?!"
Arabic/English book reference: Vol. 1, Book 1, Hadith 16