Q. Our village want to rebuild a very old mosque by demolishing it first. Is this allowed?
If a Mosque has been battered by the weather or fallen into ruin, it would not be permitted to demolish it entirely and rebuild it somewhere else. It is however, permissible to restore it or repair it. This is the opinion of Imam Abu Yusuf and upon which the fatwa is given:
“And Abu Yusuf said: a mosque remains forever until the Final Hour. It is not permitted to return it as a bequest, or to move it from one place to another nor to move its goods to another Mosque irrespective of whether people pray in it or not…”
فقال أبو يوسف يبقى مسجدا أبدا إلى قيام الساعة لا يعود ميراثا ولا يجوز نقله ولا نقل ماله إلى مسجد أخر سواء كان يصلون فيه أو لا…
And Allah knows best.
 See Ibn Nujaym, Bahr al-Ra’iq, 5:251.