"There was a woman who performed Salat behind the Messenger of Allah ﷺ who was the most beautiful among the people. Some of the people would go forward to the first line so as not to see her. Others would go back to the last line so when he would bow, he could look at her from under his armpit. So Allah revealed: Indeed We know those who try to come forward among you, and We know those who try to go back (15:24).
كَانَتِ امْرَأَةٌ تُصَلِّي خَلْفَ رَسُولِ اللَّهِ ﷺ حَسْنَاءُ مِنْ أَحْسَنِ النَّاسِ فَكَانَ بَعْضُ الْقَوْمِ يَتَقَدَّمُ حَتَّى يَكُونَ فِي الصَّفِّ الأَوَّلِ لِئَلاَّ يَرَاهَا وَيَسْتَأْخِرُ بَعْضُهُمْ حَتَّى يَكُونَ فِي الصَّفِّ الْمُؤَخَّرِ فَإِذَا رَكَعَ نَظَرَ مِنْ تَحْتِ إِبْطَيْهِ فَأَنْزَلَ اللَّهُ ( وَلَقَدْ عَلِمْنَا الْمُسْتَقْدِمِينَ مِنْكُمْ وَلَقَدْ عَلِمْنَا الْمُسْتَأْخِرِينَ )