Sayyiduna Abu Hurayrah (may Allah be pleased with him) said about this verse, "And when the Qur'an is being recited, listen attentively and keep silent" [Surah al-A'raf: 204], that people used to talk during prayer, so this blessed verse was revealed.
In the narration of Ibn Abdan it says that people (in the early days) used to keep talking during prayer, until this verse was revealed.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2887