The money that the charity has received must be one of two things:
1. Obligatory charity (zakaah)
2. General charity (sadaqah)
It is not permissible to spend zakaah on anything other than the eight categories defined by Allah, may He be exalted, in the verse on how zakaah is to be spent; they do not include building mosques or Qur'aan schools. We have discussed this previously in the answer to question no. 21805
With regard to general charity, there is no reason why it should not be spent on any charitable cause, which includes building a charitable institution to take care of orphans, unless the one who donated the money stipulated a specific way in which it was to be spent, such as sponsoring orphans, for example. In that case it is not permissible to spend it on anything else.
Shaykh Ibn Uthaymeen (may Allah have mercy on him) was asked:
A man gave someone some money to spend it on a school for memorisation of the Holy Qur'aan, but this person collected some of this money and bought a big car and said it is for the school, but he registered it in his own name. What is the ruling on this action?
Secondly: this has to do with the way in which the money he was given is spent. If it was for the general interests of the school, there is nothing wrong with buying a car if it serves the school's interests. But if the money is specifically for the teachers and students, then it is not permissible to spend it on anything else.
End quote from Majmoo Fataawa Ibn Uthaymeen, 4/330
He was also asked (may Allah have mercy on him)
There is something called winter blankets, which some charities collect and distribute to some Muslims who live in cold regions. These charities collected the blankets to keep the Muslims warm; is it possible to expand this work because the aim is still to keep Muslims warm, and in some places the poor need winter clothing, for example, or they need stoves and the like to keep warm, so that would be bought with the money that was collected to buy blankets, because the aim is the same, which is to keep Muslims warm?
It is better to call this charity Winter aid. If it is said that winter aid could apply to blankets, clothing, stoves and other things, then it is better to change the slogan under which collections are being made, and call it winter aid or winter protection.
With regard to that which was collected for a specific purpose, it should not be spent on anything except this specific purpose, so long as it has not become redundant. If we have bought winter blankets for a particular village, and that used up only half of the money collected, but they need clothing or means of warming themselves, then there is nothing wrong with spending the remaining funds on that. But if all the money is required to cover the need for blankets, then it is not permissible to spend it on anything else.
Questioner: But some people need clothing to keep warm, and they do not need blankets.
Shaykh: Yes, but the slogan or name of the campaign specified blankets, and the people need them.
Questioner: But the aim is the same, if blankets are replaced with something else.
Shaykh: But that is not right at all.
But if it is well known among the people that what is meant by winter blankets is winter aid, then that may be acceptable. Therefore it is better to change the slogan from now, and call it winter aid or something similar.
End quote from Liqa' al-Baab al-Maftooh, no. 43
And Allah knows best.
Reproduced from Islam QA