Praise be to Allah.
If what is meant is a loan from the bank, and mortgaging the house to secure the debt, then it depends:
Firstly: if the loan is to be repaid with something extra (interest), then it is a riba-based loan which is haraam.
Ibn Qudaamah (may Allaah have mercy on him) said: “Every loan in which it is stipulated that something extra must be paid back is haraam, with no difference of scholarly opinion. Ibn al-Mundhir said: [the scholars] are unanimously agreed that if the lender stipulates that the borrower must pay extra or give him a gift, and he lends him money on that basis, then accepting the extra payment is riba. It was narrated from Ubayy ibn Ka’b, Ibn ‘Abbaas and Ibn Mas’ood that they forbade every loan that brings benefits, because loans should be given as an act of kindness and an act of worship aimed at bringing one closer to Allaah. So if there is a stipulation of extra payment, this diverts the loan from its purpose.”
Secondly: if the loan is to be paid back without interest, but the bank will benefit from the house for free until the loan is paid off, then this is also haraam, and is a form of interest. The fuqaha’ have stated that if the mortgage is given for a loan, it is not permissible for the lender (the bank) to benefit from it for free, because this is a trick to have a riba-based loan. Rather if the bank wants to benefit from it, then it should rent it at the market rate, without taking any advantage.
Ibn Qudaamah said in al-Mughni (4/250): If the mortgagor (debtor) gives permission to the mortgagee (creditor) to benefit from (the property) without paying for it, and the property is a mortgage or pledge for a loan, then it is not permissible, because it then becomes a loan which brings a benefit, and that is haraam.
Ahmad said: I regard as haraam lending houses, which is pure riba, i.e., if the house is a pledge for a loan from which the mortgagee (creditor) benefits. End quote.
The scholars of the Standing Committee for Issuing Fatwas were asked: In some villages in Egypt there is a custom of mortgaging agricultural land, whereby a man who needs money takes money from the man who has money, and in return for taking the money, the owner of the money takes the agricultural land that belongs to the borrower as a pledge or mortgage. The owner of the money takes the land and benefits from its crops or what the land produces, and the owner of the land does not take anything. The agricultural land remains in the control of the creditor until the borrower pays the money back to its owner. What is the ruling on mortgaging agricultural land which involves taking what the land produces? Is it halaal or haraam?
They replied: If a person gives a loan, it is not permissible for him to stipulate that the lender should get any benefit in return for the loan, because of the report narrated from the Prophet (peace and blessings of Allaah be upon him) in which he said: “Every loan that brings a benefit is riba.” The scholars are unanimously agreed on that. That includes what is mentioned in the question about the borrower pledging or mortgaging land to the lender, and the lender benefiting from it until the loan that is owed by the land’s owner is repaid. The same applies if he owes a debt; it is not permissible for the one to whom the debt is owed to take the produce of the land or to benefit from it in return for giving the debtor more time. And because the aim of the pledge or mortgage is to guarantee that the debt will be repaid, not to make use of the pledged item in return for the loan or for delaying repayment of the debt. End quote.
Fataawa al-Lajnah al-Daa’imah (14/177).
Thirdly: If the loan is to be paid back without interest, and the bank will not benefit from the mortgaged house, or it will benefit from it in return for paying market rent, then this is permissible; it is a qard hasan (a good loan) and there is no problem with it.
If the loan is haraam, as in the first and second scenarios, then it is not permissible to get involved with it, even if the family needs a house, as you said, because of the stern warning that was issued concerning riba. We ask Allaah to keep us safe and sound. This applies even if the mortgage is done in a manner different from what we imagined; perhaps you can clarify the matter.
And Allaah knows best.