All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It is permissible for one to borrow an interest-free amount in order to pay for his Hajj expenses regardless of whether he will pay it back before going to Hajj or after returning.
The Kuwaiti Fiqhi Encyclopedia reads:
The scholars of Fiqh unanimously agreed that the principle in loans is that, on part of the lender, it is an act which brings one closer to Allah. That is because he endeavors to benefit the borrower, to provide for his need and to relieve his distress. On the part of the borrower, the fundamental ruling is that it is permissible for him to borrow as long as he intends to pay it back when he expects to receive money and intends to pay the loan back from that.
However, if the questioner means interest-based borrowing, then this is prohibited as it is usury which is forbidden by the Quran, the Sunnah and the consensus of the Muslim Ummah (nation).
We ask Allah, The Almighty, to grant us all success to make Hajj to His Sacred House and accept our righteous deeds.
Allah Knows best.