The obligation of Hajj is confirmed by the Book of Allah and the Sunnah of the Messenger of Allah, as well as the consensus agreement of the Muslim scholars. Whoever denies the obligation of Hajj will be regarded an infidel, and whoever abandons it because of his indifference to it, though he admits its obligation, he is on the verge of disbelief. It is an indication of Allah’s Mercy and Wisdom that He specified certain limits for His obligations, in order to well define responsibilities. Allah made such obligations most fit the doer, the place and the time in which such obligations should be fulfilled. Like all other obligations, Hajj has certain limits and conditions that should first be fulfilled in order to demand a Muslim to perform Hajj.
One of the conditions of the obligation of Hajj is the ability, both financially and physically.
Thus, if this condition is lacking, Hajj becomes not obligatory. Financial ability is realized when someone owns enough money to undertake the journey of Hajj after fulfilling his needs and the needs of his dependents including outlay, clothing and hire for his accommodation for one year, and after repaying the debts he owes to others, whose time of repayment is due. If someone owns money, but needs it to fulfill any of the above-mentioned obligations, he will not be obliged to make Hajj. The same applies in the case of the one who is in debt, until he repays it. The term ‘debt’ includes all credits owed by a person, including loans, purchase prices, hires, etc. Thus, one who owes, even one dollar, to another is considered a debtor and will not be obliged to make Hajj unless he repays the debt he owes. Islam attaches so much importance to fulfilling debts that a martyr’s sins will be expiated except for the debts he owed. According to Islam, the soul of the deceased is suspended until his debt is repaid on his behalf.
Hajj obligation does not fall on a man whose deferred debt is guaranteed by a pledge equal to its value, rather the debtor will be requested to perform Hajj if he has the means to do so. However, if the deferred debt is not guaranteed with a pledge that equals its value, the debtor will not be requested to perform Hajj, unless he absolves himself from this debt.
it is also permissible for a person in debt to go for hajj if he can continue to make his payments on time and will not be delayed in repayment. One could not go on hajj if doing so would hinder his payments, especially if delayed payment would result in more charges or interest.
Having said that, it is of course more preferable to pay off your mortgage first before going on hajj, especially if the loan is interest-bearing. You seem very close to paying off the entire loan — this is a huge blessing, and something you should make a top priority. Hajj however is not obligatory on you while you are overall in debt (after taking into account your assets).
Also, although hajj is not obligatory on a person overall in debt, going on hajj would fulfill his hajj obligation.
But if this loan is based on riba (usury, interest), then it is haraam and is one of the major sins and one of the seven sins that doom a person to Hell. All of the nations regarded it as forbidden, even the Greeks who were idol-worshippers. One of them, whose name was Solon said: Money is like a sterile hen; a drachma cannot give birth to a drachma.
In the Christian belief it says that one who consumes usury should not be shrouded if he dies, and even the Jews forbade usury.
Islam has forbidden it in a manner that leaves no room for doubt concerning its prohibition.
Finally, one must ensure that the wealth used for hajj is from a lawful source, as a hajj performed with unlawful money is not accepted or rewarded by Allah Most High, although the obligation would be deemed fulfilled.