The report says: 'I was ordered to fight the people until they testify that there is no god but Allah and that Muhammad is the Messenger of Allah, establish prayer and pay zakat. If they do so, their lives and property are safe from me, except for what Islam's right requires, and their reckoning is with Allah.' Classical scholars such as al-Khattabi (in his Ma'alim al-Sunan) explained that 'the people' here means the idol-worshippers of Arabia and not the People of the Book, and the Arabic word al-nas is used for a specific group elsewhere, as in 3:173. Those idolaters had fought the Muslims for years.
Other texts fix the meaning. The Quran says 'there is no compulsion in religion' and tells the Prophet ﷺ, 'you are not a controller over them'. The Prophet himself signed the treaty of Hudaybiyyah with the idol-worshippers of Mecca, and, as the biographies report, made agreements with Jewish and Christian communities that did not require them to change faith. He warned that whoever kills a person under such a covenant will not smell the fragrance of Paradise. The last phrase of the hadith, 'their reckoning is with Allah', shows that the final judgment on a person's heart is left to Allah.
To be honest, classical legal books did describe the call to Islam followed by the choice of paying jizya or fighting, in the setting of the wars between empires. Many scholars today read the sources as a law of war within that historical context, and they hold that Muslims who live in peace with others under agreements have no right to fight anyone over his beliefs. Scholars differ in how they explain the hadith, but the Quran is clear that no one can be forced to believe. Muslims invite to Islam with words, and the answer belongs to the listener.