Sayyiduna Sahl bin Abi Hathmah (may Allah be pleased with him) says: I saw Muhammad bin Maslamah (may Allah be pleased with him) following with his gaze a woman on a rooftop, named Thubaytah bint al-Dahhak, the sister of Abu Jabirah. I said: "Do you do this while you are a Companion of the Messenger of Allah (peace and blessings be upon him)?" He said: "Yes; the Prophet (peace and blessings be upon him) said: 'When Allah Almighty puts into a man's heart (the intention) to propose to a woman, there is no harm in his looking at her.'"
The chain of this hadith is disputed, and it revolves around al-Hajjaj bin Artah; what has preceded is sufficient.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب النكاح / 13491