All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It seems that there is nothing wrong with leaving for Ta’if and returning to Makkah once again as long as you will not neglect anything of the Hajj rituals or commit anything of its proscriptions. No ransom is due on you because of your going out of Makkah, regardless of whether you leave for a need or not. The pilgrim is just required to fulfill the Hajj’s pillars and obligations and avoid what is forbidden in it. There is nothing that forbids the pilgrim from leaving Makkah, moving from a place to another, and even work during the Hajj.
Allaah Knows best.