Praise be to Allah.
Being in a state of purity (tahaarah) is a condition of tawaaf being valid according to the majority of scholars, but they differed concerning a case where a person breaks his wudoo during tawaaf then does wudoo’: should he complete the circuits or start tawaaf over again? There are two opinions. The Hanafis and Shaafa‘is part of the view that he should resume his tawaaf. The Maalikis and Hanbalis are of the view that he should start tawaaf again from the beginning. See: al-Mawsoo ah al-Fiqhiyyah, 29/131
Some scholars are of the view that being in a state of purity is not essential in tawaaf. This is the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him). Based on that, the one who breaks his wudoo’ during tawaaf does not have to go out to do wudoo’. See the answer to question no. 34695.
What we understand from your question is that you completed the third circuit without wudoo’. If that is the case, then your tawaaf was not valid according to the majority of fuqaha’.
But according to the opinion of Shaykh al-Islam (may Allah have mercy on him) and those who agree with him, your tawaaf is valid.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: if I break my wudoo’ during tawaaf, what is the ruling?
He replied: If the one who is doing tawaaf breaks his wudoo’, then he has to go out of tawaaf and do wudoo’, then come back and start his tawaaf all over again. This is the view of the majority of scholars, because one of the conditions of tawaaf is being in a state of purity. But Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said that if he breaks his wudoo’ whilst he is doing tawaaf, he may carry on with his tawaaf and he does not have to do wudoo’, because wudoo’ is not one of the conditions of tawaaf. What Shaykh al-Islam (may Allah have mercy on him) said is the correct view, because there is no evidence from the Prophet (blessings and peace of Allah be upon him) to suggest that being in a state of purity is essential for tawaaf. The most that can be said is that when the Prophet (blessings and peace of Allah be upon him) wanted to do tawaaf, he did wudoo’ then did tawaaf. This is what he did, but his actions do not indicate that it is obligatory. Similarly, according to the hadeeth of ‘Aa’ishah (may Allah be pleased with her), when she got her menses, the Prophet (blessings and peace of Allah be upon him) said to her: “Do what the pilgrims do, apart from circumambulating the House.” That is because she was menstruating, and menses may contaminate the mosque in most cases. Moreover, the menstruating woman should not stay in the mosque, as is also the case for one who is junub. There is also the hadeeth of Safiyyah (may Allah be pleased with her), who got her menses after Hajj and he (the Prophet (blessings and peace of Allah be upon him)) said: “Is she detaining us?” They said: She has already done tawaaf al-ifaadah. He said: “Then move on.” This indicates that if she had been menstruating she would not have done tawaaf. Then one may argue that menses is different from minor impurity; the answer is that if being in a state of purity (wudoo’) was a must for tawaaf, the Messenger (blessings and peace of Allah be upon him) would have explained that to the people, because many people may not be in a state of purity. This is the view of Shaykh al-Islam (may Allah have mercy on him) and it is the correct view and we base our fatwas on this view. But undoubtedly being in a state of purity when doing tawaaf is preferable and more on the safe side. But sometimes things may happen that are beyond one’s control and cause hardship, such as on the days when there are huge crowds and he loses his wudoo’. If we tell him to go and do wudoo’, and he goes and does wudoo’, then comes back and starts all over again, then during tawaaf he loses his wudoo’ again, because he has gas for example, and we tell him to go and do wudoo’, then come back and start tawaaf all over again, doing wudoo’ on days when there are a lot of crowds is very difficult and it will not be easy for a man to leaves? Even if he leaves when will he find a wudoo’ place that is free? Then if he does wudoo’ and goes back, when will he be able to enter again? Enjoining upon the slaves of Allah something for which there is no clear evidence from the Qur’aan or Sunnah, when it involves such great hardship, is something for which there is no real justification. It is not appropriate for anyone to impose something like this on the slaves of Allah without clear evidence. Yes, if the matter is easy, such as at times other than Hajj, he could go out and do wudoo’, and come back and repeat tawaaf. This is something easy and we say that to be on the safe side he should do this. Whatever the case, what we think is the same as Shaykh al-Islam (may Allah have mercy on him), that wudoo’ is not essential for tawaaf.
End quote from Majmoo‘ Fataawa Ibn ‘Uthaymeen (22/361).
Tawaaf is not valid if done inside the Mas‘aa, because the Mas‘aa is outside al-Masjid al-Haraam. Hence it is permissible for a woman who is menstruating to stay there. But if the crowding is so severe and one has no alternative but to enter the Mas‘aa, then go back to the place for tawaaf, he is to be pardoned for that and his tawaaf is valid.
See also the answer to question no. 106543
And Allah knows best.