There is nothing wrong if a person performs Sa`i (walking seven times back and forth between the rocky hillocks of Safa and Marwah) before Tawaf (the seven-circuit circumambulation of the Ka`bah while reciting prayers) due to ignorance.
In this regard, Sheikh `Abdul-`Aziz ibn Baz, the late Mufti of Saudi Arabia, stated: “The Sunnah is to perform Tawaf first, then to perform Sa`i. There is nothing wrong if a person performs Sa`i before Tawaf due to ignorance. It is reported that a man asked the Prophet and said: “I performed Sa`i before Tawaf. So what should I do?” The Prophet (peace and blessings be upon him) said, “Do it and there is no harm.” This indicates that if a person performs Sa`i before Tawaf, his Hajj is still valid.”