Short answer
No rule requires underwear as such, but your awrah must stay covered and must not show through your clothes. In practice most Muslim men wear shorts, sirwal (loose trousers) or underwear under a thobe or kurta, because thin fabric can be see-through and a single garment can shift when you sit, bow or prostrate.
Covering the awrah, from the navel to the knees, is fard in front of others and in prayer; no particular garment is obligatory. Wearing a lower garment under a thin or loose outer robe is the practical way to make sure it stays covered.
The four schools agree on this.
Explanation
A Companion asked the Prophet ﷺ which parts of the body must be covered. He said: guard your awrah except from your wife. When asked about being alone, he said Allah is more deserving that one be modest before Him than people. So the duty is to keep the awrah covered, not to wear a particular item.
In the Prophet's ﷺ time men wore an izar, a wrap around the lower body, with or without a long shirt. Sirwal (trousers) were also known: at Arafah he said that a pilgrim who cannot find an izar may wear sirwal. Today a thobe or kurta is usually worn over trousers, shorts or underwear, which does the same job.
- Thin or white thobes: check them against the light. If skin shows through, wear something under it; see tight and see-through clothes.
- In prayer: if a quarter of a part of the awrah shows for the length of a pillar, the Hanafi school says the prayer is invalid, so a lower garment protects your salah.
- In ihram: men wear only the two sheets, with no underwear; see what men wear in ihram.
- At night: see is it haram to sleep naked.
The four schools agree on covering the awrah, and none of them names a required undergarment. See the awrah guide and the dress code for men.
The evidence
Quran, Surah Al-A'raaf 7:26
يَٰبَنِىٓ ءَادَمَ قَدْ أَنزَلْنَا عَلَيْكُمْ لِبَاسًۭا يُوَٰرِى سَوْءَٰتِكُمْ وَرِيشًۭا ۖ وَلِبَاسُ ٱلتَّقْوَىٰ ذَٰلِكَ خَيْرٌۭ ۚ ذَٰلِكَ مِنْ ءَايَٰتِ ٱللَّهِ لَعَلَّهُمْ يَذَّكَّرُونَ ﴿٢٦﴾
O children of Adam, We have bestowed upon you clothing to conceal your private parts and as adornment. But the clothing of righteousness - that is best. That is from the signs of Allah that perhaps they will remember.
Clothing is given to cover the awrah.
Sunan Abi Dawud 4017
Graded hasan... احفظ عورتك إلا من زوجتك أو ما ملكت يمينك ...
"Guard your awrah except from your wife or those your right hand possesses."
The duty is to keep the awrah covered.
Sahih al-Bukhari 1841
Sahih... ومن لم يجد إزارا فليلبس سراويل ...
"Whoever cannot find an izar may wear trousers."
Trousers were known as a lower garment in the Prophet's ﷺ time.
Where the ruling is recorded
- al-Hidaya, Kitab al-Salah, chapter on the conditions of prayer. A man's awrah is from below the navel to the knee.
- al-Durr al-Mukhtar with Radd al-Muhtar, Kitab al-Salah, chapter on the conditions of prayer. See-through cloth does not count as covering, and the rule of a quarter of a limb.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.