Can he interrupt tawaf to offer a naafil or obligatory prayer?
Question

I prayed inside the Hijr whilst doing tawaf from outside the Hijr. Please note that I entered the Hijr from the other side that is not regarded as being part of the Ka‘bah. Does prayer interrupt tawaf, and is it permissible?
Praise be to Allah.The Hijr is part of the Ka‘bah, so it is not valid to do tawaf from inside it, because the one who is doing tawaf is enjoined to circumambulate the House, i.e., from the outside of the entire Ka‘bah. This has been explained previously in the answer to question no. 46597.
It is stipulated that all circuits of tawaf be completed consecutively, according to the correct opinion. This is the view of the Maalikis and Hanbalis. However, a brief interruption is overlooked. This applies unless the iqaamah (call immediately preceding the prayer) is given for an obligatory prayer, or if a body is brought for the funeral prayer. In that case, one should pray and then complete tawaf. Some fuqaha’ had a different view with regard to interrupting tawaf in order to offer the funeral prayer. Some of the scholars regarded it as permissible to interrupt tawaf if a naafil prayer such as Witr or Taraweeh is offered in congregation, or if there is the fear of missing a Sunnah mu’akkadah (confirmed Sunnah) prayer such as the two Sunnah rak‘ahs before Fajr, and the tawaf is naafil. In the case of an obligatory tawaf, however, it should not be interrupted except for an obligatory prayer or a funeral prayer.
Al-Hattaab (may Allah have mercy on him) said: An obligatory tawaf should not be interrupted for anything that is not obligatory. So if a person is doing an obligatory tawaf and fears that the iqaamah may be given for Fajr prayer and he will miss out on the two rak‘ahs of Fajr, he should not interrupt tawaf for that. Yes, he may interrupt a voluntary tawaf if he fears that he will miss out on the two rak‘ahs of Fajr, so he should pray Fajr, then resume his tawaf.
End quote from Mawaahib al-Jaleel (3/77).         
Those scholars who do not stipulate that the circuits of tawaf should be consecutive – such as the Shaafa‘is – regard it as makrooh (disliked) to interrupt tawaf for no reason, in recognition of the difference of opinion as to whether doing the circuits consecutively is obligatory.
It says in Haashiyat Qalyoobi wa ‘Umayrah: In tawaf it is makrooh to eat, drink and spit; to crack the knuckles, to interlock the finger or to put them behind one’s back; to be suppressing the urge to defecate or urinate … To interrupt it to offer a fard kifaayah (e.g., funeral) or naafil prayer, or to do the prostration of recitation or the prostration of gratitude. All of that is when there is no reason to do those things. End quote.
See: al-Majmoo‘ (8/65); al-Mughni (3/197); Mataalib Ooli an-Nuha (2/399).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Question: What if the iqaamah for an obligatory prayer is given whilst one is doing tawaf? We say: The scholars differed concerning that:
Some of them said: If the tawaf is naafil, he may interrupt it and pray, because the Prophet (blessings and peace of Allah be upon him) said: “When the iqaamah for prayer is given, there is no prayer except the obligatory prayer.” That is because it is a naafil tawaf. Therefore if the iqaamah is given for an obligatory prayer, he should interrupt it and offer the obligatory prayer, then resume his tawaf. But if the tawaf is obligatory, then he should continue with his tawaf even if he misses out on the obligatory prayer.
Other scholars said: Doing the circuits consecutively is not an essential condition, and it is permissible to interrupt tawaf. A person may interrupt the circuits and not do them consecutively, and there is nothing wrong with that. However we should note that the parts of a single act of worship must be done consecutively in order for it to be regarded as a single act of worship, except in cases where the evidence indicates that it is permissible to interrupt it. The more correct view concerning such matters is that if the iqaamah is given for an obligatory prayer, then the individual may interrupt [tawaf] with the intention of resuming it after the prayer.
If he interrupts it – and let us assume that he interrupts it when he is in line with the Hijr, then when the prayer is over, should he resume tawaf from the place where he interrupted it, or should he start tawaf all over again?
The scholars differed concerning that. The well-known view in our madhhab is that it is essential to start that circuit all over again. The more correct view is that it is not essential and that he may resume from where he left off, because what he did before he paused was a partial circuit, and a partial circuit does not have to be regarded as invalid, because if we say it is obligatory to regard it as invalid, then we will be obliging the person to do the act of worship twice, and there is nothing to support that.
Question: can a person interrupt his tawaf in order to offer the funeral prayer?
What appears to be the case is yes, (he may do that), because the funeral prayer is brief and the interruption will not be lengthy, so it may be overlooked.
End quote from ash-Sharh al-Mumti‘ (7/276).
One of the reports from the salaf (early generations) about a brief interruption (in the circuits of tawaf) was narrated from Jameel ibn Zayd, who said: I saw Ibn ‘Umar circumambulating the Ka‘bah on a hot day. He did three circuits, then the heat affected him, so he entered the Hijr and sat down, then he came out and resumed his tawaf. It was narrated from ‘Ataa’ that there is nothing wrong with a person sitting down during tawaf to rest. See: al-Musannaf by Ibn Abi Shaybah (4/454); al-Muhalla by Ibn Hazm (5/219).
Conclusion: the circuits of tawaf must be done consecutively and should not be interrupted for the purpose of prayer unless it is an obligatory prayer or a funeral prayer. There may be a concession regarding one rak‘ah of Witr for one who is afraid of missing it, if his tawaf is naafil, because the time it takes is brief.
And Allah knows best.