Background: Some think that in Islam there is no freedom of religion allowed. For example, residents of a Muslim country or under Islamic law are not allowed to practice their own faith.
The Quran states, in no uncertain terms, that there is no compulsion in religion:
Let there be no compulsion in religion: Truth stands out clear from Error: whoever rejects evil and believes in God has grasped the most sure hand-hold, that never breaks. And God is Hearing, Knowing. [2:256]
Each to their own way:
“Nor will I serve what you serve,
Nor will you serve what I serve,
To you is your system, and to me is my system.”
This is a reminder, so let he who wishes take a path to his Lord. [73:19]
The Quran states that God could have made all those on earth believe, thus asks who is man to enforce such a thing if God did not:
And if your Lord had pleased, surely all those who are in the earth would have believed, all of them; will you then force men till they become believers? [10:99]
Again, reminding us not to compel but simply warn by means of The Quran, with wisdom and kind words:
We know best what they say, and you are not one to compel them; therefore remind by means of The Quran who fears My warning. [50:45]
You shall invite to the path of your Lord with wisdom and kind words, and debate with them in the best possible manner. Your Lord knows best who has strayed from His path, and He knows best who are the guided ones. [16:125]
Interestingly, all examples in The Quran of persecution due to faith are as a threat from non-believers and tyrants against believers [e.g. 11:91, 19:46, 36:18, 26:116, 7:123-124]. Thus it could be argued a trait of an ignorant society is no freedom of religion.
And lastly, a proof beyond doubt, is that The Quran itself states anyone compelled or forced to believe or admit to something under duress is invalid with God:
Whoever rejects God after having believed; except for one who is forced while his heart is still content with belief; and has opened his chest to rejection, then they will have a wrath from God and they will have a great retribution. [16:106]
Thus, no enforcement of faith can take place in a society governed by the laws of The Quran.
Please also read chapter 9 in which the believers of the time were living side by side with polytheists (i.e. those who associate partners with God). Also the numerous examples of the presence of Jews and Christians with the muslims of the time.