[Machine] This verse was revealed specifically to the Ansar, who were in the period of Ignorance (before Islam) when they performed the pilgrimage and were not allowed to perform the sa'i (the ritual of walking between Safa and Marwa). When we arrived (in Medina), we mentioned this to the Messenger of Allah ﷺ , and Allah revealed the following verse: "Indeed, Safa and Marwa are among the symbols of Allah" (Surah Al-Baqarah 2:158) until the end of the verse.
إِنَّمَا نَزَلَتْ هَذِهِ الْآيَةُ فِي الْأَنْصَارِ كَانُوا فِي الْجَاهِلِيَّةِ إِذَا أَحْرَمُوا لَا يَحِلُّ لَهُمْ أَنْ يَطُوفُوا بَيْنَ الصَّفَا وَالْمَرْوَةِ فَلَمَّا قَدِمْنَا ذَكَرُوا ذَلِكَ لِرَسُولِ اللَّهِ ﷺ فَأَنْزَلَ اللَّهُ ذَلِكَ {إِنَّ الصَّفَا وَالْمَرْوَةَ مِنْ شَعَائِرِ اللَّهِ} [البقرة 158] «إِلَى آخِرِ الْآيَةِ»