Does the Quran encourage Muslims to kill non-Muslims?
This verse was revealed about the Battle of Badr. The pagans of Mecca travelled more than 200 miles to Madinah with an army of about 1000 to kill the Muslims who numbered around 300. The Prophet Muhammad and fellow Muslims had suffered severe persecution, torture and even murder of their brethren for 13 years in the city of Mecca at the hands of these very same pagans.
And once the Muslims had fled Mecca and found a sanctuary in the city of Madinah, they were followed by the pagans of Mecca. By this verse God gave the order to Muslims to fight to defend their lives and faith, as they had previously been forbidden from defending themselves.