All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Straightening rows in prayers means standing closely, shoulders to shoulders and feet to feet as reported in the Sunnah. Anas reported that the Prophet said: "Straighten your rows for I see you from behind my back." Anas added: "Every one of us used to put his shoulder to the shoulder of his companion (i.e. the person standing next to him) and his foot to the foot of his companion.' [Al-Bukhari]
It is reported in Sunan Abu Dawood that the Prophet used to order thrice (before starting the prayer): "Straighten your rows. I swear by Allaah, you straighten your rows otherwise Allaah will turn your heart against one another." The narrator said: "I noticed after that everyone of the companions joined his shoulder to the shoulder of the person standing next to him, his knee to his knee and his ankle to his ankle." Anas said: 'If you want to do the same today, people would bolt as if they were balky mules." [Abu Shaybah]
Besides, the Prophet said: "Straighten your rows and stand close to each other." He [the Prophet] aslo said: "Join your rows and stand shoulder-to-shoulder. I swear by Whose Hands the soul of Muhammad is, I see the devils penetrating between the rows as does a young goat". [Al-Nasaa'i and Abu Daawood]
All the above Ahadeeth prove that straightening the rows means standing closely, joining shoulder-to-shoulder and ankle-to-ankle.
Therefore, it is wrong to leave gaps between rows as practiced by many people regardless of whether it is due to not straightening the rows or not standing close to each other.
Hence, we advise all the Muslims to follow the order of the the Prophet in straightening the rows.
It is possible that the disagreement and disunity of the Muslims nowadays is due to not straightening their rows as the Prophet said: "You will straighten your rows or Allaah will put disagreement in your hearts." [Abu Daawood]
Allaah Knows best.