The Quran says: God forbids you not, with regards to those who fight you not
for [your] faith nor drive you out of your homes, from dealing kindly and
justly with them; for God loveth those who are just. (Quran, 60.8)

It is one function of Islamic law to protect the privileged status of
minorities, and this is why non-Muslim places of worship have flourished all
over the Islamic world. History provides many examples of Muslim tolerance
towards other faiths: when the caliph Omar entered Jerusalem in the year
634, Islam granted freedom of worship to all religious communities in the
Islamic law also permits non-Muslim minonties to set up their own courts,
which implement family laws drawn up by the minorities themselves.
When the caliph Omar took Jerusalem from the Byzantines, he insisted on
entering the city with only a small number of his companions. Proclaiming to
the inhabitants that their lives and property were safe, and that their
places of worship would never be taken from them, he asked the Christian
patriarch Sophronius to accompany him on a visit to all the holy places.
The Patriarch invited him to pray in the Church of the Holy Sepulchre, but
he preferred to pray outside its gates, saying that if he accepted, later
generations of Muslims might use his action as an excuse to turn it into a
mosque. Above is the mosque built on the spot where Omar did pray.