Praise be to Allah
Paying off debt takes precedence and is more important than offering the udhiyah during the days of Eid, for a number of reasons:
Paying off debt is obligatory, whereas offering the udhiyah is a confirmed Sunnah. What is Sunnah does not take precedence over what is obligatory. Even according to the view of those scholars who say that the udhiyah is obligatory, paying off debts takes precedence over it, because the udhiyah is only obligatory – according to those who say that it is obligatory – for the one who is able to afford it, and the one who is in debt is not able to afford it.
Paying off debt discharges one’s obligations, and offering an udhiyah will lead to one remaining under obligation, and undoubtedly discharging one’s obligations takes precedence over remaining under obligation.
Paying off debt is a duty that is owed to other people, whereas offering the udhiyah is something that is recommended to be done for Allah, may He be exalted, and the dues owed to people take precedence in this case.
Moreover, leaving the debt exposes one to grave danger, because there is the fear that the debtor would have to pay off his debt on the Day of Resurrection from his hasanaat (good deeds), if Allah does not pay it off on his behalf. That is a matter of grave danger, because on that Day the Muslim will be in the greatest need of every single hasanah.
Thus it becomes clear that paying off debt is more important than offering the udhiyah, and no exception is made from that except in the case where the debt is deferred for a lengthy period, in such a way that the debtor thinks it most likely that he will be able to pay off the debt when that time comes, if he offers the udhiyah now, or he has given some collateral for his debt that will make it possible to pay it off if he is unable to do so when the time comes. In that case it is permissible for him to offer whatever udhiyah Allah enables him to, and he will have the reward for that with Allah, may He be exalted.
It says in al-Liqa’ ash-Shahri (no. 53; question no. 24):
Question: What is the ruling on offering the udhiyah if a person owes a debt to be repaid in the future? Is it acceptable, or must he seek permission from the one to whom he owes the debt?
I do not think that a person should offer the udhiyah when he owes a debt, unless the debt is to be paid in the future, and he knows in his heart that when the time for repaying the debt comes, he will be able to pay it off. In that case there is nothing wrong with him offering the udhiyah; otherwise he should save the money that he has in order to pay off the debt. Debt is a serious matter, my brothers. If a man (who had died) was brought to the Messenger (blessings and peace of Allah be upon him) for him to offer the funeral prayer for him, he would refrain from offering the funeral prayer for him. Then one day one of the Ansaar (who had died) was brought to him, and he took a few steps, then he said:
“Did he owe a debt?” They said: Yes. He said: “Offer the funeral prayer for your companion.” And he did not offer the funeral prayer for him until Abu Qataadah (may Allah be pleased with him) stood up and said: I will pay the two dinars (that he owed). He said: “Are you paying these two dinars to the creditor to absolve the deceased of his debt?” He said: Yes, O Messenger of Allah. So he came forward and offered the prayer.
When he was asked about martyrdom for the sake of Allah and whether it would expiate everything, he said:
“Except debt.” Martyrdom does not expiate debt, so it is not an insignificant matter. So save yourselves and do not let the country be struck by financial calamity in the future, because those who take on debts and take the matter lightly will go bankrupt later on, then after them those who lent them money will also become bankrupt. The matter is extremely serious. Allah, may He be glorified and exalted, has stipulated that financial duties (as prescribed in Islam) are not obligatory unless a person can afford to do them, so one should praise and thank Allah for that. End quote.
It says in ash-Sharh al-Mumti‘ (8/455):
If he owes a debt then he should start by paying it off before offering the udhiyah. End quote.
See also the answer to question no. 41696
And Allah knows best.