There is a consensus among jurists that covering the awrah for both men and women in prayer, is obligatory. The Almighty Allah says in the Quran,
O Children of Adam, take your adornment (by wearing proper clothing) for every mosque. (Al-A`raf 7:31)
Salamah ibn Al-Akwa` (may Allah be pleased with him) said to the Prophet (peace be upon him): “O Messenger of Allah, may I pray in a long shirt?” He said: “Yes, but button it, even with just a thorn.” (Al-Bukhari)
Ibn Abdul Barr said: “Scholars have agreed upon the invalidity of the prayer of one who prays naked while he is capable of wearing clothes” or something similar. So, covering the awrah is from the conditions of the validity of the prayer if he is able.
Sheikh Waleed Basyouni highlights the cases that awrah might be exposed during prayer and what could one do in such situation?
Source: Faithiq Yourube Channel.Soucre Link