It should be noted that it is narrated that there is a great reward for walking to the mosque, and that the worshippers who will have the greatest reward are those whose houses are further away.
It was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Messenger of Allaah (peace and blessings of Allaah be upon him) said: "Shall I not tell you something by means of which Allaah erases sins and raises people in status?" They said: Yes, O Messenger of Allaah. He said: "Doing wudoo' properly at times when it is difficult to do so, taking many steps to the mosque, and waiting for prayer after prayer. That is constant readiness." Narrated by Muslim, 251.
It was narrated that Abu Moosa (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “The people who will receive the greatest reward for prayer are those who walk the furthest distance to come and pray, then those who walk the next furthest.” Narrated by Muslim, 662.
This hadeeth and the one before it point to the virtue of living far from the mosque, so that one may take more steps, which will bring reward, the abundance of which depends on how far away one's house is, as well as how often one comes to the mosque.
It was narrated that Ubayy ibn Ka’b (may Allaah be pleased with him) said: There was a man, and I do not know of any man who lived further away from the mosque than he did, but he never missed a prayer. It was said – or I said – to him: Why don’t you buy a donkey that you can ride when it is dark or when the sand is too hot? He said: I would not like my house to be next to the mosque. I want my walking to the mosque and my returning when I come back to my family, to be recorded for me. The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Allaah has gathered all that (reward) for you.” Narrated by Muslim, 663.
Look at this great reward from our generous Lord. The hadeeth indicates that the reward is given for the steps taken when returning from the prayer as well as when coming to it. Hence this Sahaabi preferred to walk on foot despite the fact that his house was so far from the mosque.
It was narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Whoever purifies himself in his house then walks to one of the houses of Allaah in order to perform one of the duties enjoined by Allaah, for every two steps he takes, one will erase a sin and the other will raise him one degree in status.” Narrated by Muslim, 666.
It was narrated from Buraydah al-Aslami (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: “Give glad tiding to those who walk to the mosque in darkness, of perfect light on the Day of Resurrection.” Narrated by Abu Dawood, 561; classed as saheeh by al-Albaani in Saheeh Abi Dawood.
It says in Daleel al-Faatiheen (3/558-559): “Darkness” here refers to the darkness at the time of ‘Isha’ and Fajr. This hadeeth points to the virtue of walking to prayer whether it is a long walk or a short one, and the virtue of walking to pray in congregation in the darkness of the night. End quote.
This virtue is assured – in sha Allaah – for the one who prays ‘Isha’ and Fajr in congregation, even if the way is lit, because these two prayers take place in the darkness of the night.
These ahaadeeth and others encourage the Muslim to strive to come to the mosque walking, not riding, even if his house is far away, so long as it does not cause hardship and he does not have an excuse such as being old and so on, and he should not accustom himself to travelling by car if the mosque can be reached on foot without difficulty.
In addition to these great virtues of walking to the mosque – namely that sins are erased, being raised in status, great reward and perfect light on the Day of Resurrection – there are other important benefits for the body:
Walking to the mosque is a form of exercise in and of itself, which brings innumerable benefits. It plays a major role in strengthening the body and giving energy, by Allaah's leave, so that the person will become able to fight disease and sickness.
Walking to the house of Allaah every day at certain times will suffice to train the muscles and improve one’s physical condition. Walking to the mosque also plays a role in protecting the body against diseases that are caused by inactivity and sitting too much, above all obesity, because walking helps to get rid of fat.
Walking is also a remedy against heart disease, because it gives the heart – by Allaah's leave – the ability to work hard and improve the circulation.
Walking to the mosque is also a remedy for mental exhaustion and thinking too much, because it restores to mind to its natural state and helps one to relax, physically and mentally.
In conclusion, walking to the houses of Allaah brings many health benefits, as explained by modern medicine. These are immediate benefits with which Allaah blesses His believing slave in this world, when he responds to the call of Allaah. And there is a great reward and perfect light in the Hereafter too, in sha Allaah.
See: Ahkaam Hudoor al-Masaajid, 60-62 – by Shaykh ‘Abd-Allaah al-Fawzaan .