Praise be to Allaah.
The correct view is that in the rows of prayer, we should stand shoulder to shoulder and foot to foot.
Al-Bukhaari, may Allaah have mercy on him, narrated (683) from Anas that the Prophet (peace and blessings of Allaah be upon him) said: “Make your rows straight, for I can see you from behind my back.”
Anas said: “so each of us would stand with his shoulder against his neighbour’s shoulder and his foot against his foot.”
Al-Bukhaari (may Allaah have mercy on him) gave this chapter the title: “Chapter on standing shoulder to shoulder and foot to foot.”
He said: al-Nu’maan ibn Basheer said: “I saw people standing with their ankles against their neighbours’ ankle.”
Shaykh ‘Abd al-‘Azeem al-Abaadi said: he said in al-Ta’leeq al-Mughni: These ahaadeeth clearly indicate the importance of making the rows straight, which is part of the perfection of prayer; they indicate that people should not stand back (from the row) or in front of (the row), and that they should stand shoulder to shoulder, foot to foot and knee to knee with their neighbours. But nowadays this Sunnah is being ignored! If someone does this nowadays the people shy away from him like zebras! Verily to Allaah we belong and unto Him is our return.
(‘Awn al-Ma’bood, 2/256)
The shoulder: is the place where the upper arm joins the body.
The ankle: is the bone which protrudes at the side of the foot.
And Allaah knows best.
Sheikh Muhammed Salih Al-Munajjid