عَنْ عُقْبَةَ بْنِ عَامِرٍ رَضِيَ اللَّهُ عَنْهُ عَنْ رَسُولِ اللَّهِ أَنَّهُ قَالَ: ((إِذَا تَطَهَّرَ الرَّجُلُ ثُمَّ أَتَى الْمَسْجِدَ يَرْعَى الصَّلَاةَ كَتَبَ لَهُ كَاتِبَاهُ أَوْ كَاتِبُهُ بِكُلِّ خُطْوَةٍ يَخْطُوها إِلَى الْمَسْجِدِ عَشْرَ حَسَنَاتٍ، وَالْقَاعِدُ يَرْعَى الصَّلَاةَ كَالْقَانِتِ وَيُكْتَبُ مِنَ الْمُصَلِّينَ مِنْ حِينَ يَخْرُجُ مِنْ بَيْتِهِ حَتَّى يَرْجِعَ إِلَيْهِ))
It is narrated from Sayyiduna Uqbah bin Amir (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: When a servant performs ablution and comes towards the mosque and waits for the prayer, then both the recording angels, or one of them, write ten good deeds for every step he takes towards the mosque. And the person who sits and waits is like one who is standing in prayer, and that person is counted among the worshippers from the time he leaves his house until he returns home.