Establishing a masjid for a community is something that is encouraged in Islam. A masjid acts more than just a place of worship, it often allows communities to offer education and acts as a base from which community services are delivered (lectures, funerals, wedding ceremonies etc). (reference)
Contributing towards building a masjid is also considered as a form of ongoing charity (Sadaqah Jariyah), where the donor will continue to gain rewards as long as it is still being used, even after his soul has departed from this world.
For more information about helping in building a masjid, visit our information page.