If one of my friends sees me naked or if I uncover my ‘awrah in front of him whilst fasting, does that invalidate my fast?.
Showing the ‘awrah in front of others for whom it is not permissible to see it is haraam. It is not permissible for anyone to do that, whether in Ramadaan or at any other time. It is haraam to uncover it and it is haraam to look at it.
It was narrated from Bahz ibn Hakeem from his father that his grandfather [Mu’aawiyah ibn Haydah al-Qushayri] (may Allaah be pleased with him) said: I said: O Messenger of Allaah, with regard to our ‘awrah, what may we uncover of it and what must we conceal? He said: “Cover your ‘awrah except from your wife and those whom your right hand possesses (i.e., concubines).” I said, O Messenger of Allaah, what if a man is with another man? He said, “If you can make sure that no one sees it, then do not let anyone see it.” I said, O Messenger of Allaah, what if one of us is alone? He said, “Allaah is more deserving that you should feel shy before Him than people.” Narrated and classed as hasan by al-Tirmidhi (2769); narrated by Ibn Maajah (1920); classed as hasan by al-Albaani in Saheeh al-Tirmidhi.
It was narrated from Abu Sa’eed al-Khudri (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “No man should look at the ‘awrah of another man, and no woman should look at the ‘awrah of another woman.” Narrated by Muslim, 338.
Al-Nawawi (may Allaah have mercy on him) said: This shows that it is haraam for a man to look at the ‘awrah of another man and for a woman to look at the ‘awrah of another woman, and there is no difference of opinion concerning that. End quote.
Sharh Muslim, 4/30
But if the issue is showing the ‘awrah unintentionally, then there is no sin on you, and the other person has to avert his gaze and not look at it.
Fasting is not invalidated in either case – whether it is done deliberately or by mistake; in the answer to question no. 38023 we have explained the things that invalidate the fast.
In the answer to question no. 37658 we have explained the effect that sin has on the fast, and that it reduces the reward, and may erase it altogether.
And Allaah knows best.