عن أنس أن اليهود كانوا إذا حاضت المرأة فيهم لم يؤاكلوها ولم يجامعوهن في البيوت فسأل أصحاب النبي ﷺ النبي ﷺ فأنزل الله تعالى ﴿ ويسألونك عن المحيض قل هو أذى فإعتزلوا النساء في المحيض ﴾ إلى آخر الآية فقال رسول الله ﷺ اصنعوا كل شيء إلا النكاح
صحيح مسلم كتاب الحيض
Anas related that the Jews, whenever a woman among them menstruated, they did not have meals with her nor did they have sex with them at home. And the Companions of the Prophet (SAW) inquired with the Prophet (SAW), and Allah Most High sent down { And they ask you about menstruation; say: this is a harmful thing, therefore keep away from women during menstruation } until the end of the verse [Al-baqara 222]. And the Messenger of Allah (SAW) said: Do everything except relations [nikah].
Sahih Muslim, The book of menstruation