(a) Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Prophet (peace and blessings be upon him) said: "A good word is charity, and walking to the mosque is charity."
(b) In the hadith of Ma'mar: "Every step taken towards the mosque for the prayer is charity."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5875
Yazid bin Abi Maryam (may Allah have mercy on him) says: I was walking to Jumu'ah when Abayah bin Rifa'ah bin Rafi' bin Khadij (may Allah have mercy on him) met me on the way, and he was riding. He said: Count these steps of yours as being in the path of Allah, for I heard Abu Abs bin Jabr al-Ansari (may Allah be pleased with him) say that the Prophet (peace and blessings be upon him) said: "Whoever's feet become dusty in the path of Allah, Allah will make those feet forbidden to Hell."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5876
Sayyiduna Aws bin Aws al-Thaqafi (may Allah be pleased with him) says: I heard the Messenger of Allah (peace and blessings be upon him) say: "Whoever washes his head on Friday and takes a bath, then sets out early in the morning, walks and does not ride, sits close to the imam, listens attentively to the sermon and does not engage in idle talk, for every step he will receive the reward of a year of fasting and standing in prayer."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5878
Abu al-Ahwas narrates from Abdullah bin Mas'ud (may Allah be pleased with him): Walk to the prayer, for those who were better than you, namely Abu Bakr and Umar (may Allah be pleased with them both) and the Ansar and the Muhajirun (may Allah be pleased with them), used to walk to the prayer. Keep your steps close together and remember Allah much, and let your companion be the one who helps you in the remembrance of Allah.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجمعة / 5880