It was narrated from 'Abdullah bin 'Amr that the Messenger of Allah (ﷺ) said:
"A debt will be settled on the Day of Resurrection if the one who owes it dies, apart from three: A man who lost his strength fighting in the cause of Allah (SWT), so he borrows in order to become strong again to fighting in the cause of Allah (SWT), so he borrows in order to become strong again to fight the enemy of Allah (SWT) and his enemy. A man who sees a Muslims die and he cannot find anything with which to shroud him except by taking a loan. A man who sees a Muslim die and he cannot find anything with which to shroud him except, by taking a loan. A man who fears Allah (SWT) if he stays single, so he gets married for fear of (losing) his religious commitment. Allah will pay off the debt for these people on the Day of Resurrection."
English reference: Vol. 3, Book 15, Hadith 2435
Arabic reference: Book 15, Hadith 2529