‘Abdullāh ibn ‘Umar (may Allah be pleased with him) reported: ‘Umar ibn al-Khattāb (may Allah be pleased with him) said: "O Messenger of Allah, may anyone of us sleep while being ritually impure?" He said: "Yes, he may sleep if he makes ablution."
شرح الحديث :
‘Umar ibn al-Khattāb (may Allah be pleased with him) asked the Prophet (may Allah’s peace and blessings be upon him) about whether it is permissible for a man to sleep in a state of ritual impurity at the earlier part of the night, after having sexual intercourse with his wife, even if there is no ejaculation, or having a wet dream. The Prophet (may Allah’s peace and blessings be upon him) declared it permissible, provided that this major ritual impurity is lessened with ablution.