Allah the Exalted said:
٢٩١ - باب تحريم الخلوة بالأجنبية
Allah the Exalted said:
O you who have believed, do not enter the houses of the Prophet except when you are permitted for a meal, without awaiting its readiness. But when you are invited, then enter; and when you have eaten, disperse without seeking to remain for conversation. Indeed, that [behavior] was troubling the Prophet, and he is shy of [dismissing] you. But Allāh is not shy of the truth. And when you ask [his wives] for something, ask them from behind a partition. That is purer for your hearts and their hearts. And it is not [conceivable or lawful] for you to harm the Messenger of Allāh or to marry his wives after him, ever. Indeed, that would be in the sight of Allāh an enormity.
ʿUqbah ibn ʿĀmir (may Allah be pleased with him) reported that the Messenger of Allah ﷺ said: “Beware of entering upon women!” A man from the Anṣār said: “What about the in-law (al-ḥamw)?” He said: “The in-law is death!” Agreed upon. “Al-ḥamw” is a relative of the husband, such as his brother, his nephew, and his cousin.
Ibn ʿAbbās (may Allah be pleased with them both) reported that the Messenger of Allah ﷺ said: “None of you should be alone with a woman except in the presence of a maḥram [of hers].” Agreed upon.
Buraydah (may Allah be pleased with him) reported that the Messenger of Allah ﷺ said: “The sanctity of the wives of those who fight in Allah’s cause, in the eyes of those who stay behind, is like the sanctity of their own mothers. There is no man among those who stay behind who takes the place of one of the fighters in regard to his family and then betrays him concerning them, but that [the fighter] will be made to stand before him on the Day of Resurrection, and he will take from his good deeds whatever he wishes until he is satisfied.” Then the Messenger of Allah ﷺ turned to us and said: “So what do you think?” Narrated by Muslim.