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 is His slave and Messenger.
Insurance is an act conditional on a possible risk; which is what might happen to the building being insured. Sometimes such a risk occurs, and at other times, it does not. This act is null and void in Islam for the harm it induces.
So, it is forbidden to do it regardless of the thing being insured (a mosque or else).
Allah knows best.