Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) says that some beautiful women used to pray behind the Prophet (peace and blessings be upon him). Some people would stand in the last row of the men and look at them. Some of them would look at them from under their armpits, and some would come forward to the first row so that they would not see them. So Allah Almighty revealed this verse: "We know those who go forward to the first rows in prayer and those who remain in the last rows." [Surah al-Hijr: 24]
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5169