عَنْ ابْنِ عُمَرَ رَضِيَ اللَّهُ عَنْهُمَا، أَنَّ رَسُولَ اللَّهِ صلى الله عليه و سلم قَالَ: "أُمِرْت أَنْ أُقَاتِلَ النَّاسَ حَتَّى يَشْهَدُوا أَنْ لَا إلَهَ إلَّا اللَّهُ وَأَنَّ مُحَمَّدًا رَسُولُ اللَّهِ، وَيُقِيمُوا الصَّلَاةَ، وَيُؤْتُوا الزَّكَاةَ؛ فَإِذَا فَعَلُوا ذَلِكَ عَصَمُوا مِنِّي دِمَاءَهُمْ وَأَمْوَالَهُمْ إلَّا بِحَقِّ الْإِسْلَامِ، وَحِسَابُهُمْ عَلَى اللَّهِ تَعَالَى" .
رَوَاهُ الْبُخَارِيُّ ، وَمُسْلِمٌ .
Bukhari: God's Apostle said, I have been ordered to fight with the people till they say, None has the right to be worshipped but God. (Volume 4, Book 52, Number 196)
With regards to the narration, only part of it has been quoted, and the full text reads:
And the Prophet (peace be upon him) said, "I have been ordered to fight the people until they testify that there is no deity worthy of worship other than Allah and that Muhammad is the Messenger of Allah, establish the prayer, and pay zakat, and if they do this, then their blood and money shall be protected from me, except by an Islamic right, and their account will be with Allah.
This narration lists some of the pillars of Islam that Muslims must adhere to. The fighting being ordained here refers to the enforcement of laws and regulations within an Islamic state. Just as modern governments enforce their legal policies, so to does the Islamic state. These legal policies refer to Muslims paying their Zakat (charity tax) and abiding by the laws in an Islamic state. Those who understood the sayings of the Prophet Muhammad (peace be upon him) the best, were his companions, and we can examine their application of the sayings of the Prophet Muhammad (peace be upon him) to derive a better understanding. We find that after the death of the Prophet Muhammad (peace be upon him), many hypocrites who had pretended to be Muslim began to turn away and leave their religious duties, one example was Zakat (the charity tax). They wanted to compromise the commands of God. It was then that Abu Bakr, the First Caliph and the Caliph of that time, cited this narration to make it clear that a compromise would not be tolerated and he would fight them until they agreed to follow Islam in full. The fighting that resulted was known as the Riddah wars. Similarly, we can see that today's governments would not tolerate it if a citizen refused to pay tax or abide by the laws of the country. If one lives in a state or country they must abide by the regulations to ensure a secure and healthy society. We should note that the 'people' referred to in this narration does not refer to all of humanity. As Shaykh Ahmed Ibn Taymiyyah says:
“It refers to fighting those who are waging war, whom Allah has permitted us to fight. It does not refer to those who have a covenant with us with whom Allah commands us to fulfill our covenant.” (Majmu` al-Fatawa 19/20)
Clearly, this narration does not refer to imposing Islam upon non-Muslims, since the Qur'an explicitly states:
2:256 There is no compulsion in religion...