بُلُوغُ الْمَرَامِ
Bulugh al-Maram 442
The Book of Prayer
وَعَنْ عِمْرَانَ بْنِ حُصَيْنٍ رَضِيَ اَللَّهُ عَنْهُمَا قَالَ: { كَانَتْ بِي بَوَاسِيرُ, فَسَأَلْتُ اَلنَّبِيَّ - صلى الله عليه وسلم -عَنْ اَلصَّلَاةِ؟ فَقَالَ: صَلِّ قَائِمًا, فَإِنْ لَمْ تَسْتَطِعْ فَقَاعِدًا, فَإِنْ لَمْ تَسْتَطِعْ فَعَلَى جَنْبٍ } رَوَاهُ اَلْبُخَارِيُّ.
Narrated 'Imran bin Husain (RA): I suffered from piles. So I asked the Prophet (ﷺ) about the prayers. He said: "Pray standing; and if you are unable, (pray) sitting; and if you are unable, (pray) lying on your side." [Reported by al-Bukhari].
Sunnah.com reference: Book 2, Hadith 357