All perfect praise be to Allah the Lord of the Worlds. May His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
The loan is the transfer of money to someone who benefits from it, with the obligation to repay an equivalent amount, seeking the pleasure of Allah. It is permissible for the borrower, and recommended for the lender.
The obligation in a loan is for the borrower to repay it in the same form in which it was borrowed. If the borrower took money, they must repay money of equivalent value. If they borrowed gold, they must repay gold of equivalent weight. Ownership in a loan is established upon receipt, and it remains in the borrower's liability according to the form received.
The Imam Al-Khatib Al-Shirbini, may Allah have mercy on him, said: "The repayment in loans should be equivalent in kind, because it is closer to fulfilling the right of the lender" [Mughni al-Muhtaj, Vol. 3/P.33]. This is also affirmed by the International Islamic Fiqh Academy in its fifth session, stating: "The criterion for repaying debts is with like for like, not by value, because debts are settled with their equivalents."
In conclusion, if the wife sells the gold and pays her husband the price in cash, the borrower (husband) is obligated to repay the amount of cash he borrowed. However, if she pays the gold to her husband and he sells it, then he must repay the equivalent amount of gold in weight. There is no objection if he repays it in cash at the time of repayment, based on the mutual agreement of both parties on the day of repayment, using the gold price on that day. It is essential that the exchange takes place in the same session, ensuring that no part of the debt remains in the debtor's responsibility after the exchange. And Allah the Almighty knows best.