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: "Whoever performs ablution, then gathers his garments, then goes out to the mosque, the angel who records for him writes ten good deeds for every step; a person is counted as being in prayer as long as he is waiting for the prayer; and from the time he leaves his house until he returns, he is recorded among those who pray."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14902