هُمُ الَّذِينَ كَفَرُوا وَصَدُّوكُمْ عَنِ الْمَسْجِدِ الْحَرَامِ وَالْهَدْيَ مَعْكُوفًا أَن يَبْلُغَ مَحِلَّهُ ۚ وَلَوْلَا رِجَالٌ مُّؤْمِنُونَ وَنِسَاءٌ مُّؤْمِنَاتٌ لَّمْ تَعْلَمُوهُمْ أَن تَطَئُوهُمْ فَتُصِيبَكُم مِّنْهُم مَّعَرَّةٌ بِغَيْرِ عِلْمٍ ۖ لِّيُدْخِلَ اللَّهُ فِي رَحْمَتِهِ مَن يَشَاءُ ۚ لَوْ تَزَيَّلُوا لَعَذَّبْنَا الَّذِينَ كَفَرُوا مِنْهُمْ عَذَابًا أَلِيمًا
“They are the ones who persisted in disbelief and hindered you from the Sacred Mosque, preventing the sacrificial animals from reaching their destination. [We would have let you march through Makkah] had there not been believing men and women unknown to you. You might have trampled them underfoot, incurring guilt for [what you did to] them unknowingly. That was so Allah may admit into His mercy whoever He wills. Had those [unknown] believers stood apart, We would have certainly inflicted a painful punishment on the disbelievers.”
This ayah is part of Surah al-Fath, revealed -- as this event's own significance note states -- "concerning this incident" (Q48:1), the Treaty of Hudaybiyyah.