The Prophet (peace and blessings be upon him) placed great emphasis on straightening the rows during congregational Prayer and stated many hadiths concerning this issue.

`Abdullah ibn `Umar(may Allah be pleased with them both) reported that the Prophet (peace and blessings be upon him) said, “Straighten your rows, bring in line your shoulders, fill in the gaps, co-operate with your brothers, i.e. in arranging and straightening the rows and do not leave empty spaces for the devils. Whoever fills in the gap Allah will shower His mercy on him and whoever leaves a space in the row Allah will deprive him of His mercy.” (An-Nasa’i)

Al-Bara’ ibn `Aazib related, “The Prophet(peace and blessings be upon him) would walk within the rows, from one side to another, straightening them. He would pass his hands over our chests and shoulders, and say, “Do not disperse, otherwise your hearts will become disunited.” He would also say, “Allah the Almighty sends blessings upon those who stand in the first row and the angels seek forgiveness on their behalf.” (Abu Dawud)

Anasibn Malik reported that the Prophet (peace and blessings be upon him) said, “Pull your rows together, keep them close and keep your necks in line, for by He in whose hands rests the soul of Muhammad, indeed I see the devils entering the gaps in the rows as though they are small sheep.” (Abu Dawud)

We can understand from these narrations that straightening and arranging the rows of the Prayers is a Sunnah of the Prophet (peace and blessings be upon him) through standing beside one another without leaving a gap in between. However, touching the feet with those of the next person was not established by the Prophet (peace and blessings be upon him), neither verbally nor through practice. Touching the feet may be a means, in the beginning of the Prayer, for the purpose of straightening the rows, but not during the Prayer.

Dr. Hatem al-Haj, associate professor of Fiqh stated:

There are three opinions in this regard: one that does not prescribe touching the feet at any time (they prescribe aligning by the shoulders), and one that prescribes it in the beginning of the Prayer and throughout, and a third that only prescribes this at the beginning, for the purpose of aligning the rows.
the stronger position – in my view – is the last one. This is because
Al-Bukharinarrated from Anas (may Allah be pleased with him) that the Prophet (peace and blessings of Allah be upon him) said:
Make your rows straight, for I can see you from behind my back.” Anas (may Allah be pleased with him) said: “Thus, each of us used to put his shoulder against his neighbor’s shoulder and his foot against his foot.”

In the hadith of An-Nu`man ibn Bashir, he mentioned the ankles instead of the feet. (Abu Dawud)

Now, we can understand from this that they had their feet touching throughout the Prayer, but I believe that it means only touching the feet at the beginning for the purpose of aligning; however, during the Prayer, one should be focusing on the Prayer and achieving a state of khushu` (attention with humble tranquility).

It is important to mention here that the alignment of the rows at the beginning of the Prayer is an important Sunnah according to the majority of scholars. Moreover, according to many of the scholars such as Ibn Taymiyahand Ibn Hajar, it is mandatory and that seems to be the stronger position. This is particularly true when you contemplate this hadith of the Messenger of Allah (peace and blessings of Allah be upon him), who said: “Align your rows, lest Allah will misalign your hearts.” (Abu Dawud)

We should take heed of this threat, and realize that the exterior, as known to be a fact of psychology, has an impact on the interior.

Also, the abandonment of the Sunnah will bring about division between us, and adhering to it is the way to achieve unity. This is only common sense, since there is one prophet and one Sunnah, but there are many satanic tricks. Furthermore, the disagreement between the scholars, such as the four great imams, is not attributed to any of them abandoning the Sunnah, but rather different ways of understanding it. Once it was clear to any of them that the Prophet (peace and blessings be upon him) prescribed something, they never hesitated to follow it.

This mandatory Sunnah has been forsaken by many Muslims. It is our duty to revive the Sunnah of the Messenger (peace and blessings of Allah be upon him).