Are the thighs 'awrah?
A disagreement has arisen about this. This is mainly due to those who came after the pious predecessors of Islam. These are the later Maliki scholars and Ibn Hazm.
The truth of the matter is that the thighs are 'awrah. Some narrations may seem to contradict one another which has caused some doubts in some people. The pious predecessors eventually agreed that the thighs are 'awrah. They mainly used the narration of Jarhad.
Jarhad reported: The Messenger of Allah (ﷺ) sat with us and my thigh was uncovered. The Messenger of Allah (ﷺ) said: "Do you not know that the thigh is 'awrah?"
[Sunan Abi Dawud 4014, Kitab al-Hammam, Chapter: The Prohibition of Nudity]
Jarhad reported: The Messenger of Allah (ﷺ) passed me when I was in the mosque with my thigh exposed. He then said to me, "The thigh is 'awrah."
[Sunan Tirmidhi 2795, Manners, Chapter: About the thigh that is part of the 'awrah]
Those who believe the thighs are not 'awrah
Some use narrations to indicate that the thighs are not 'awrah. For example, they use the narration of Anas ibn Malik. This indicates that the thigh of the Prophet (ﷺ) was exposed. This cannot be used as proof because it can have different interpretations.
Anas ibn Malik reported: The Prophet (ﷺ) rode and Abu Talha also rode and I rode behind Abu Talha. My knee touched the thigh of the Prophet (ﷺ) as he drove past. The Prophet (ﷺ) bared his thigh until I saw the whiteness of his thigh.
[Sahih al-Bukhari 371]
Another narration used is from Zayd ibn Thabit. The thigh of the Prophet (ﷺ) fell on the thigh of Zayd ibn Thabit. This is an invalid argument because it was due to a predominant calm that overcame the Prophet (ﷺ) while receiving revelation.
Zayd ibn Thabit reported: I was sitting next to the Prophet (ﷺ) one day when the revelation came to him.
The Prophet was overcome with calm and his thigh fell on my thigh as the calm overtook him. By Allah, I have never found anything heavier than the thigh of the Messenger of Allah, then he was relieved from it.
The Prophet said: "Write, O Zayd." I took a shoulder bone and the Prophet said, "Write: Not equal are those who remain behind and those who wage jihad among the believers," to the end of the verse, "...a great reward," (4:95). So I wrote that on a shoulder bone.
[Musnad Ahmad 21156]
Others also use the narration of 'Aicha, which said that the Prophet (ﷺ) bared his shin or thigh in front of Abu Bakr and Umar, but then covered it with Uthman.
This narration contains ambiguity as to whether it concerned the thigh or shin. This makes it invalid to use this as proof.
'Aicha reported:
The Prophet (ﷺ) was lying in the bed in my apartment with his thigh or shins uncovered and Abu Bakr asked permission to enter. It was given to him and he spoke to him in the same state (the Prophet's thigh or shins uncovered).
Then 'Umar asked permission to enter and it was given to him and he spoke in the same state.
Then `Uthman asked permission to enter; the Prophet (ﷺ) sat down and corrected his clothes. He ('Uthman) then went in and spoke and he went out.
'Aicha said: Abu Bakr came in and you did not move and you did not correct your clothes, when 'Umar came in you did not move and you did not correct your clothes, but when 'Uthman came you moved and corrected your clothes. The Prophet (ﷺ) replied: "Should I not show modesty to one whom even the Angels show modesty?"
[Sahih Muslim 2401]
Imam Bukhari gave more clarity about this. He moved more towards the opinion that the thighs fall under 'awrah. This is because the narrations on that are abundant and are a safer position.
مَا يُذْكَرُ فِي الفَخِذِ
وَيُرْوَى عَنِ ابْنِ عَبَّاسٍ، وجَرْهَدٍ، ومُحَمَّدِ بْنِ جَحْشٍ رضي الله تعالى عنهم، عَنِ النَّبِيِّ ﷺ: الفَخِذُ عَوْرَةٌ ، وقَالَ عنه: «حَسَرَ النَّبِيُّ ﷺ عَنْ فَخِذِهِ» «وَحَدِيثُ أَنَسٍ أَسْنَدُ، وحَدِيثُ جَرْهَدٍ أَحْوَطُ حَتَّى اخْتِلاَفِهِمْ»، وقَالَ أَبُو مُوسَى رضي الله عنه: غَطَّى النَّبِيُّ رُكْبَتَيْهِ دَخَلَ عُثْمَانُ وقَالَ زَيْدُ بْنُ ثَابِتٍ رضي عنه: اللَّهُ عَلَى فَخِذِي، فَثَقُلَتْ عَلَيَّ حَتَّى خِفْتُ أَنْ تَرُضَّ فَخِذِي .
Imam Bukhari said:
It was narrated on the authority of Ibn Abbas, Jarhad and Muhammad bin Jahsh, may God Almighty be pleased with them, on the authority of the Prophet (ﷺ): "The thigh is 'awrah."
Anas, may God be pleased with him, said: "The Prophet (ﷺ) uncovered his thigh." The hadith of Anas is isnaad (stronger in chain) and the hadith of Jarhad is ahwaht (safer)."
Abu Musa, may God be pleased with him, said: The Prophet (ﷺ) covered his knees when Uthman entered.
And Zaid bin Thabit, may God be pleased with him, said: God sent revelation upon His Messenger, peace and blessings be upon him and his thigh fell upon my thigh."
[Introduction to 'Chapter What Is Mentioned About the Thigh' in Sahih Bukhari]
The madhahib agree that the thighs are 'awrah and that they should not be uncovered, in and out of prayer.
عبد اللَّه: سألت أبي عن الفخذ من العورة؟
قال: نعم، حديث جرهد عن النبي -صلى اللَّه عليه وسلم-: "الفخذ عورة"
"مسائل اللَّه" (221)
Imam Ahmad said:
"The thigh is 'awrah. This is established in the Hadith of Jarhad that the Prophet (ﷺ) said: "The thigh is 'awrah""
[Masail Abdullah 221]