All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
We would like to thank your wife for her good intention, and we ask Allah to reward her generously and guide her to carry out all the good deeds and charitable acts to which she aspires.
If she is going to take this loan through an illegitimate transaction, such as a loan with interest, which is a kind of Riba (interest), then it is impermissible for her to take it. One may not draw closer to Allah except by what He has made lawful of deeds and wealth. Abu Hurayrah, may Allah be pleased with him, narrated that the Prophet, sallallahu ‘alayhi wa sallam, said:
"O people, Allah is Good, and He accepts only that which is good. Allah commanded the believers as He commanded the Messengers, by saying (what means): {O messengers, eat from the good foods and work righteousness. Indeed, I, of what you do, am Knowing.} [Quran 23:51] He also says (what means): {O you who have believed, eat from the good things which We have provided for you...} [Quran 2:172] He, sallallahu ‘alayhi wa sallam, then mentioned a man who travels a long distance with his hair disheveled and covered in dust, then he raises his hand towards the sky (and supplicates Allah), 'O Lord, O Lord,' while his food is unlawful, his drink is unlawful, and his clothes are unlawful and his nourishment is unlawful. How then would his supplication be accepted?" [Muslim]
However, if she is going to take this loan through lawful means, such as Istisnaa‘ (a contract with a worker to manufacture something with some particular features) or Muraabahah (co-partnership) or the like, which are provided by Islamic banks, then there is no harm in that and she is allowed to take a loan for the purpose of building the mosque or any other charitable project, especially given that she has property to mortgage against the loan.
We would like to highlight two points:
First, it is better for the Muslim to refrain from taking loans, even if he needs the loan to carry out a charitable act, if the loan taker does not have enough wealth to repay it. Verily, a debt is a serious matter, and it entails liability. The Muslim should not incur debts except in case of need. The Prophet, sallallahu ‘alayhi wa sallam, refrained from performing the funeral prayer over the deceased if he was liable for debts until his debts were settled by someone on his behalf.
Given the gravity and seriousness of incurring debts, ‘Abdullaah ibn ‘Amr ibn Al-‘Aas, may Allah be pleased with them, narrated that the Prophet, sallallahu ‘alayhi wa sallam, said, "All the sins of a martyr are forgiven, except debt." [Muslim] Moreover, Abu Hurayrah, may Allah be pleased with him, reported that the Prophet, sallallahu ‘alayhi wa sallam, said, "A believer‘s soul remains suspended on account of his debt until it is settled on his behalf." [At-Tirmithi and Ibn Maajah]
Second, when one wishes to spend in charity, he should find out what the people really need first. If the people of his community need a mosque, he may build one for them. However, if there is no need for another mosque in the neighborhood, he may instead build an orphanage or a shelter for the poor as an endowment (Waqf) and the like of charitable projects.
Allah knows best.