Building a masjid in a place where it is not expected Muslims will remain permanently is permissible
Praise be to Allaah.
All praises are due to Allaah. A masjid should be built or a building should be converted into a masjid due to the general benefit and good to the Muslims that are present, and considering that it manifests and makes prominent the rituals and rites of Islam. In addition, it raises and inspires hope that it will play a role in attracting many Muslims, and result in some of the people who live in the area accepting Islam.
Sheikh Muhammed Salih Al-Munajjid