I don't think there is a rule of law guiding that but perhaps there some in some countries that experience war, I don't think a country that has long gone into war (after wwII) will have that in mind but just as you have said, when if it is the government that mortgage out the property and later experienced war, they might reduce some money or even forget about because in serious war, there could be casualties and you don't expect people that are mourning to come pay you, Isn't that what the government was form for? at least have some sympathy. However, if it was a company and there is an agreement, I don't think they might want to let go but incase they sue you to court, the judge will cannot be harsh on the person, nobody pray for war isn't.
It is understandable for governments and lenders to be more lenient towards borrowing countries who are unable to make their mortgage payments due to the hardships of war. War can cause significant disruption to people's lives, and it is unreasonable to expect them to prioritize debt payment over their immediate needs for food, shelter, and medical care. In many cases, governments and lenders will offer temporary measures to help borrowers cope with the challenges of war. These measures can provide borrowers with breathing room and help them to get back on their feet once the war is over.
In the case of government-backed mortgages, probably the government will be willing to waive or reduce the debt. This is because the government has a vested interest in ensuring that its citizens are able to rebuild their lives after the war. For private mortgages, the situation is more complex. Private lenders are generally bound by the terms of their contracts. In some cases, private lenders may even consider taking a loss in order to avoid seizuring on a property that is destroyed by the war.