Does looking at women invalidate the fast?
This question includes two issues:
1 – The ruling on looking at women
2 – Does looking at women invalidate the fast or require expiation (kafaarah)?
With regard to the ruling on looking at women, it is haraam because Allaah has commanded the believers to lower their gaze. Allaah says (interpretation of the meaning):
“Tell the believing men to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts)”
This was also enjoined by His Messenger (peace and blessings of Allaah be upon him). It was narrated that Jareer said: I asked the Messenger of Allaah (peace and blessings of Allaah be upon him) about a sudden accidental glance. He said, “Avert your gaze.” Narrated by Abu Dawood, al-Nikaah, 1836; classed as saheeh by al-Albaani in Saheeh Abi Dawood, no. 1880.
Hence it is obligatory to follow the command of Allaah and His Messenger. Allaah says (interpretation of the meaning):
“And let those who oppose the Messenger’s (Muhammad’s) commandment (i.e. his Sunnah legal ways, orders, acts of worship, statements) (among the sects) beware, lest some Fitnah (disbelief, trials, afflictions, earthquakes, killing, overpowered by a tyrant) should befall them or a painful torment be inflicted on them”
With regard to the second issue, which is the effect of looking at non-mahram women on one's fast, the Standing Committee was asked about this and they replied: It does not invalidate the fast, but he must lower his gaze. Fataawa al-Lajnah al-Daa’imah li’l-Ifta’, 10/274
So the Muslim, especially one who is fasting, must avert his gaze from them (women) so that his fasting will not be undermined by haraam things. Whoever does such a thing must repent to Allaah.