Asim Ahwal reported,

I asked Anas bin Malik about Safa and Marwa, and he said, "They were among the rites of the pre-Islamic period, so when Islam came, we refrained from them. Then Allah تبارك وتعالى revealed, "Indeed, Safa and Marwa are among the symbols of Allah. So whoever makes Hajj to the House or performs Umrah, there is no blame upon him for walking between them" [Baqarah 2:158]."He said, "They are voluntary." "And whoever volunteers good, then indeed, Allah is Appreciative and Knowing" [Baqarah 2:158].

Tirmidhi 2966

Sahih

حدثنا عبد بن حميد حدثنا يزيد بن أبي حكيم عن سفيان

عن عاصم الأحول قال

سألت أنس بن مالك عن الصفا والمروة فقال كانا من شعائر الجاهلية فلما كان الإسلام أمسكنا عنهما فأنزل الله تبارك وتعالى {إن الصفا والمروة من شعائر الله فمن حج البيت أو اعتمر فلا جناح عليه أن يطوف بهما} قال هما تطوع {ومن تطوع خيرا فإن الله شاكر عليم}

الترمذي 2966صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Tafsir of the Quran
Chapter
From Surah Baqarah
Numbering
Darussalam 2966
Tirmidhi 2966