Sayyiduna Ali (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "Do not follow a glance with another glance (i.e., if your gaze unintentionally falls upon a non-mahram woman, do not look at her again), for the first glance is forgiven, but the second is a sin upon you."
In the first hadith, there is a command to protect one’s ears from hearing such things which the speaker would not like to be heard, and for the one who does so, there is a severe warning that molten lead will be poured into his ears.
The second hadith pertains to the gaze, and believing men and women are commanded to lower their gazes, and not to look at any non-mahram with lustful or evil intent. If a man’s gaze unintentionally falls upon a non-mahram woman, then there is no accountability upon him, but he should not look again; rather, he should turn his gaze away. However, if he looks intentionally, he will be sinful, and this fault and sin will not be forgiven without repentance.