Praise be to Allah.
Al-Bukhaari (986) narrated that Jaabir ibn ‘Abd-Allah (may Allah be pleased with him) said: On the day of Eid, the Prophet (peace and blessings of Allah be upon him) would vary his route, i.e., he would go via one route and come back via a different route.
The believer is required to follow the example of the Prophet (peace and blessings of Allah be upon him) even if he does not know the reason why the Prophet (peace and blessings of Allah be upon him) did something. Allah says (interpretation of the meaning):
“Indeed in the Messenger of Allah (Muhammad) you have a good example to follow for him who hopes for (the Meeting with) Allah and the Last Day, and remembers Allah much” [al-Ahzaab 33:21]
Ibn Katheer said (3/756): This verse points to an important principle, namely following the example of the Messenger of Allah (peace and blessings of Allah be upon him) in word and deed.
The scholars differed greatly as to the reason for this (i.e., returning via a different route).
The scholars differed greatly as to the reason for this. I have collected more than twenty different opinions, which I have summed up and highlighted those that are weak. Al-Qaadi ‘Abd al-Wahhaab al-Maaliki said: Several opinions have been mentioned concerning that, some of which are likely to be correct but most of which are far-fetched.
1-He did that so that the two routes would bear witness for him, or it was said: so that their inhabitants, jinns and humans, would bear witness for him
2-It was said that it was so as to make them equal because they are blessed by his passing through.
3-It was said that his route to the prayer-place was to his right, and if he came back the same way he would be coming to the left, so he went back by a different route. This requires evidence.
4-It was said that it was to make manifest the symbols of Islam on both routes, or to make manifest the remembrance of Allah.
5-It was said that it was to annoy the hypocrites or the Jews, or to alarm them by showing the large number of those who were with him. Ibn Battaal thought this was most likely to be correct.
6-It was said that it was a precaution against the plots of the two groups, or one of them. This needs verification.
7-It was said that he did that in order to make more people happy or bring blessing to them by his passing through or by their seeing him, and so that he might attend to their needs, answer their questions, teach them, give them charity, greet them with salaam, etc
8-It was said that it was in order to visit his relatives and uphold the ties of kinship.
9-It was said that it was in order to have a change of scene.
10-It was said that that when he went he gave charity and when he came back he had nothing left, so he came back via a different route so that he would not have to refuse anyone who asked of him. This is a very weak view as well as one that requires proof.
11-It was said that that route by which he went was longer than the route by which he came back, and he wanted to increase his reward by taking more steps to get there, but on the way back he was hastening to go home. This is the view favoured by al-Raafi’i, but he stated that it requires evidence and that the reward for taking steps also applies to the way back, as was proven in the hadeeth of Ubayy ibn Ka’b which was narrated by al-Tirmidhi and others.
12-It was said that the angels stand on the roads and he wanted two groups of angels to bear witness for him.
Ibn al-Qayyim mentioned some of these reasons in Zaad al-Ma’aad (1/449), then he said:
The most correct view is that he did this for these and other reasons.
Shaykh Ibn ‘Uthaymeen said: If it is said, what is the reason for coming back by a different route?
The answer is: to follow the Messenger of Allah (peace and blessings of Allah be upon him).
“It is not for a believer, man or woman, when Allah and His Messenger have decreed a matter that they should have any option in their decision. And whoever disobeys Allah and His Messenger, he has indeed strayed into a plain error”
[al-Ahzaab 33:36 – interpretation of the meaning]
This is the reason… Then he mentioned some of the reasons quoted above from al-Haafiz.
Majmoo’ Fatawa Ibn ‘Uthaymeen, 16/222.