Shaykh Ibn Uthaymeen was asked:
Question:
Is it from the Sunan of the Prophet (ﷺ) that he faced the Qiblah when he was sleeping or during his sleep? Has [an evidence] been reported that proves that and where should the feet be when facing the Qiblah?
Answer:
“I do not know that facing the Qiblah when sleeping is Sunnah. However, there is the well-known Hadith:
الكعبة قبلتكم أحياء وأمواتاً
The Ka’bah is your Qiblah for the living and the dead
[Something similar is reported by Abu Dawood (no. 2875) and it has been graded Hasan by Imam al-Albani in Saheeh Sunan Abi Dawood (no. 2875)]
And this is general. Entering into it is that a person lies towards the Qiblah in his sleep.
As for what has been reported in the Sunnah, then it is sleeping on the right side. This is better. However, we find some people lie on their back, some people lie on their stomach, and some people on their left hand. This is against the Sunnah. So what is best is to sleep on the right side; however, if you see in your sleep what you dislike [i.e. a nightmare] and you are on your right side, then you move to your left side. This indicates that sleeping on the right side is not obligatory, but rather better”.
[al-Liqa’aat ar-Ramadaaniyyah (pg. 542-543)]
Translated by
Faisal bin Abdul Qaadir bin Hassan
Abu Sulaymaan