All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
This Hadeeth was narrated by Muslim, At-Tirmithi and others, and the wording of Muslim is as follows: Jaabir narrated that the Prophet saw a woman, so he came to his wife Zaynab and found her tanning a leather, and he had sexual intercourse with her. He then went to his Companions and told them: “A woman advances in the shape of a devil and retires in the shape of a devil, so if anyone of you sees a woman, he should come to his wife (and have intercourse with her), for that will repel what he feels in his heart.”
So, with this context you would know the circumstance in which it was said.
The benefits that can be taken from the Hadeeth, according to Imaam An-Nawawi are: “It is desirable when a man sees a woman who arouses his desire to go to his wife – or his slave-girl, if any – and have sexual intercourse with her, for that would repel what he feels and he would prevent himself from the evil thoughts that he had.”
He also said about the meaning of the saying of the Prophet : “A woman advances in the shape of a devil and retires in the shape of a devil.”: “The scholars said that this is a reference to desire, and the invitation [by desire] to be tempted by her (the woman) as Allaah put in the hearts of men an inclination towards women, and pleasure from looking at them and whatever is related to them; so she is like the devil in his invitation to evil by his whispers and the way he beautifies evil. What we conclude from this is that a woman should not go out among men except for a necessity, and that a man should lower his gaze from looking at her dress [let alone at her body] and he should totally turn away from her.”
Al-Qaadhi Abu Bakr ibn Al-‘Arabi made an important statement about this Hadeeth, and we are going to quote it in a summarized form: “This Hadeeth is unusual in its meaning, because what happened to the Prophet was a secret and no one knew it except Allaah, but he announced it to the people as a way of consoling and instructing them. The Prophet was a human being and he had desires but he was infallible. He was not to be blamed for his thoughts which he had when he saw that woman, and this does not diminish his status. His admiration for that woman is part of human nature, but he overcame those thoughts by his infallibility and he succeeded in suppressing those feelings. He resorted to his wife in order to give his human desire its right of fulfilment by keeping himself chaste and preventing himself from sin.”
Ibn Al-'Arabi added: “In this Hadeeth, there is an answer to the Sufis who believe that a man should kill his desire to a point that a woman for them is just like a wall that they hit against; indeed, monasticism is not a part of this religion.” [End of quote]
Allaah Knows best.