Abdullah bin Abbas reported,

Ismail's mother began nursing Ismail and drinking from that water, until what was in the waterskin ran out. She became thirsty and her son became thirsty, and she began watching him writhing, or he said, tossing about. She walked away, unable to bear watching him, and found that Safa was the nearest hill in that area to her. She stood upon it and faced the valley, looking to see if she could see anyone, but she saw no one. So she descended from Safa, and when she reached the valley, she lifted the edge of her garment and ran with the running of an exhausted person until she crossed the valley. Then she came to Marwa and stood upon it, looking to see if she could see anyone, but she saw no one. She did this seven times.Ibn Abbas said, "The Prophet ﷺ said, 'That is why people perform the saee between them.'"

Azami 5043

Sahih

عن عبد الله بن عباس، قال

… وجعلت أم إسماعيل ترضع إسماعيل وتشرب من ذلك الماء، حتى إذا نفد ما في السقاء عطشت وعطش ابنها وجعلت تنظر إليه يتلوى- أو قال يتلبط- فانطلقت كراهية أن تنظر إليه فوجدت الصفا أقرب جبل في الأرض يليها فقامت عليه ثم استقبلت الوادي تنظر هل ترى أحدا؟ فلم تر أحدا فهبطت من الصفا حتى إذا بلغت الوادي رفعت طرف درعها، ثم سعت سعي الإنسان المجهود حتى جاوزت الوادي ثم أنت المروة فقامت عليها ونظرت هل ترى أحدا؟ فلم تر أحدا، ففعلت ذلك سبع مرات. قال ابن عباس: قال النبي ﷺ: فذلك سعي الناس بينهما.

الأعظمي 5043صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Hajj
Chapter
Description of the Hajj of the Prophet ﷺ as narrated by Jabir and others, and the rulings mentioned therein
Section
Explanation of the reason for walking between Safa and Marwa
Numbering
Jami al-Kamil 5043 (2nd edition)
Azami 5043