The Prophet ﷺ entered the state of ihram for hajj. When he arrived, he performed tawaf around the Kaaba and walked between Safa and Marwa, but he did not shorten his hair or exit the state of ihram, because of the sacrificial animal he had brought. He commanded those who had not brought a sacrificial animal to perform tawaf, walk between Safa and Marwa, and then either shorten or shave their hair and exit the state of ihram.
حدثنا هشيم أنبأنا يزيد بن أبي زياد عن مجاهد
أهل النبي ﷺ بالحج فلما قدم طاف بالبيت وبين الصفا والمروة ولم يقصر ولم يحل من أجل الهدي وأمر من لم يكن ساق الهدي أن يطوف وأن يسعى وأن يقصر أو يحلق ثم يحل