According to the Holy Qur'an, he prayed:
O our Lord! I have left part of my family in a valley where nothing grows, close to Your Holy House. Our Lord! This is so they can set up prayer. So make the hearts of the people kind towards them and provide them with fruits so that they may be grateful. (Quran 14:37)Although Hajira was alone in the desert, she had learnt from her husband to trust in Allah and be patient. When she became hungry and thirsty and could no longer feed her baby, she tried to look for water, searching between the hills of Safa and Marwah, but she was unsuccessful. Finally, she returned to her baby, disappointed. Suddenly, she saw that a stream of water was flowing out from where Prophet Ismael had struck the ground with his foot. She was very happy and drank her fill.
Meanwhile, the water had attracted a flock of birds. The people of the tribe of Jarham, who lived nearby, were following the birds in search of water. When they saw Hajira and Prophet Ismael alone in the desert, they invited them to come and live with their tribe.
Hajira and Prophet Ismael began to live with the tribe of Jarham. Sometimes, Prophet Ibrahim used to visit them. On one of his visits when Prophet Ismael was 13 years old, Prophet Ibrahim dreamt that he was sacrificing his son. It was the 8th of Zilhaj, also known as Yawme Tarwiyah (The Day of the First Dream). Prophet Ibrahim often received Allah's commands in his dreams, but because he was being asked to actually kill his son, he wondered whether it was real.
On the next day he saw the same dream and was now sure that it was a true command. Thus, the 9th of Zilhaj is known as Yawme Arafaat (The Day of Sure Knowledge).
The Holy Qur'an says:
And when (Ismael) became Baaligh, he (Ibrahim) said, "O my son! I saw in a dream that I am sacrificing you. What is your view?" He (Ismael) said, "O father! Do as you have been commanded. If Allah wills, you will find me from the patient ones." (Quran 37:102)
Prophet Ibrahim took a rope and a knife, and led his son into the desert. On the way, Shaitan appeared in the form of an old man, and tried to convince Prophet Ibrahim that he was making a terrible mistake in killing his son. Three times Shaitan came, and each time Prophet Ibrahim made him go away by throwing seven small stones at him.
When they reached Mina, Prophet Ibrahim laid his son on the ground and took the knife. Prophet Ismael saw how distressed his father was at having to kill him, so he said, "O my father! Tie my hands and legs so that I do not struggle. Put a blindfold over your eyes so that you do not have to see me die and tighten your cloak so that my mother does not see my blood splattered on your clothes. Make your knife sharp so that you can do your job quickly. That way I will feel no pain."
Prophet Ibrahim did as his son requested, and then cut the throat of his son. But when he removed the blindfold, he was surprised to see his son standing safe besides him and that he had slaughtered a male sheep instead.
The Holy Qur'an says:
And We called out to him, "O Ibrahim, Indeed you have proved your dream true. This is how We pay back people who do good. Indeed this was a clear trial, and We ransomed him with a Great Sacrifice. And We gave (this blessing) to one from the later times." Peace be upon Ibrahim. (Quran 37:104-109)
Thus Allah told Prophet Ibrahim that He was rewarding him for his faith by saving Prophet Ismael. Instead of his son, the blessing of sacrifice in the Way of Allah would be given to a person in the future. This person was none other than Imam Husain, who sacrificed himself, his family members and his friends on the plains of Kerbala for the sake of Islam.
After his son had been saved, Prophet Ibrahim left for Palestine to return to Sarah. Allah made the actions of Prophet Ibrahim and his family wajib for all Muslims. Thus, when we go for Haj, we walk between Safa and Marwah just as Hajira did. We also go to Mina and offer an animal for sacrifice and stone the Shaitans.
On one of his visits, Prophet Ibrahim was ordered by Allah to rebuild the Holy Ka`ba, which had broken down.
The Holy Qur'an says:
And Ibrahim raised the foundations of the House (Holy Ka'aba) with Ismael, (praying), "O our Lord! accept this from us. You are the All-Hearing, the All-Knowing. (Quran 2:127)
The two of them built the Holy Ka`ba together. Prophet Ismael carried the stones and Prophet Ibrahim paved them in place. The angel Jibraeel guided them at every step and showed them where to put the Holy Black Stone (Hajare Aswad). It still remains in the same place today. After the building was ready, they performed the Haj. Prophet Ismael settled in Makkah and lived there all his life. Our Holy Prophet Muhammad is from his descendants.
(Courtesy of:- Shia Ithna asheri Madressa)