Quran 9:5 says "kill the polytheists wherever you find them". Critics quote it to argue that Islam commands Muslims to kill unbelievers and that the religion was spread by force.
Excepted are those with whom you made a treaty among the polytheists and then they have not been deficient toward you in anything or supported anyone against you; so complete for them their treaty until their term [has ended]. Indeed, Allah loves the righteous [who fear Him].Quran 9:4, Sahih International
And when the inviolable months have passed, then kill the polytheists wherever you find them and capture them and besiege them and sit in wait for them at every place of ambush. But if they should repent, establish prayer, and give zakāh, let them [go] on their way. Indeed, Allah is Forgiving and Merciful.Quran 9:5, Sahih International
And if any one of the polytheists seeks your protection, then grant him protection so that he may hear the words of Allah [i.e., the Qur’ān]. Then deliver him to his place of safety. That is because they are a people who do not know.Quran 9:6, Sahih International
How can there be for the polytheists a treaty in the sight of Allah and with His Messenger, except for those with whom you made a treaty at al-Masjid al-Ḥarām? So as long as they are upright toward you, be upright toward them. Indeed, Allah loves the righteous [who fear Him].Quran 9:7, Sahih International
Would you not fight against a people who broke their oaths and determined to expel the Messenger, and they had begun [the attack upon] you the first time? Do you fear them? But Allah has more right that you should fear Him, if you are [truly] believers.Quran 9:13, Sahih International
Surah 9 opens by addressing specific polytheist tribes of Arabia who had made treaties with the Muslims and broken them (Quran 9:1). Ibn Kathir records from Mujahid, Ibn Ishaq, Qatadah and others that the "inviolable months" in verse 5 are a four-month grace period announced in verse 2. The passage gives its own reasons: these tribes broke their oaths, tried to expel the Prophet Muhammad (peace and blessings be upon him), and began the fighting (Quran 9:13).
The same passage limits the command. Those who kept their treaties are excepted, and their treaties must be honored to the end (Quran 9:4). As long as others are upright, Muslims must be upright with them (Quran 9:7). Any polytheist who asks for protection must be given it, taught the message and escorted to safety, with no requirement to convert (Quran 9:6). Justin Parrott (Yaqeen Institute) quotes Professor M. A. S. Abdul Haleem: the passage gives many reasons for the order, and at least eight times it mentions the wrongs these particular people committed against the Muslims.
To be fair to the record, some classical scholars did say that this verse abrogated earlier verses about peace. Parrott notes that many jurists did not accept that view, and that those who did generally meant the later verses added exceptions, not that the principle of non-aggression was cancelled.
Fight in the way of Allah those who fight against you but do not transgress. Indeed, Allah does not like transgressors.Quran 2:190, Sahih International
There shall be no compulsion in [acceptance of] the religion. The right course has become distinct from the wrong. So whoever disbelieves in ṭāghūt and believes in Allah has grasped the most trustworthy handhold with no break in it. And Allah is Hearing and Knowing.Quran 2:256, Sahih International
Allah does not forbid you from those who do not fight you because of religion and do not expel you from your homes - from being righteous toward them and acting justly toward them. Indeed, Allah loves those who act justly.Quran 60:8, Sahih International
“Narrated Ibn `Umar: During some of the Ghazawat of Allah's Messenger a woman was found killed, so Allah's Messenger forbade the killing of women and children.”Sahih al-Bukhari 3015, grading: Sahih (in Sahih al-Bukhari). English translation as given on sunnah.com
“Whoever killed a person having a treaty with the Muslims, shall not smell the smell of Paradise though its smell is perceived from a distance of forty years.”Sahih al-Bukhari 3166, grading: Sahih (in Sahih al-Bukhari). English translation as given on sunnah.com
The historian Richard Bulliet, whose study of conversion is widely cited, rejects the stereotype that Islam was spread by the sword. His "conversion curve" shows that in the lands under early Muslim rule only around a tenth of the population had converted during the Umayyad period, and that majorities took centuries to form. Large Christian and Jewish communities lived under Muslim rule in Egypt, Syria and Iraq for the following fourteen centuries. Indonesia, the country with the most Muslims today, was never conquered by a Muslim army; Islam reached it through traders, local rulers who adopted it, and Sufi teachers.
Critics who quote Quran 9:5 rarely apply the same reading to their own scripture.
But of the cities of these peoples, that Yahweh your God gives you for an inheritance, you shall save alive nothing that breathes; but you shall utterly destroy them: the Hittite, the Amorite, the Canaanite, the Perizzite, the Hivite, and the Jebusite; as Yahweh your God has commanded you;Deuteronomy 20:16-17, World English Bible (public domain)
Now go and strike Amalek, and utterly destroy all that they have, and don’t spare them; but kill both man and woman, infant and nursing baby, ox and sheep, camel and donkey.’”1 Samuel 15:3, World English Bible (public domain)
Jewish and Christian readers usually explain these commands as limited to particular peoples at a particular time, the Canaanite nations and Amalek, and not as a standing command. That is a reasonable way to read a text. Quran 9:5 deserves the same treatment, and its limits are stated in the passage itself. The difference is that the biblical commands name women, infants and nursing babies among those to be killed, while the Prophet Muhammad forbade the killing of women and children.
Quran quotations: Sahih International via quran.com. Hadith quotations: the English translations and gradings shown on sunnah.com. Bible quotations: World English Bible (public domain).