All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
The version of this Hadeeth that you have mentioned is cited in Saheeh Muslim and the same narration is also cited in Saheeh Al-Bukhari. In fact, this Hadeeth is cited by Abu Daawood, An-Nasaa'i, At-Tirmithi and Ibn Maajah . After consulting the books that explain Ahaadeeth, we could not find any particular circumstances or specific context in which this Hadeeth was said. In fact, this is not strange since it is not necessary for each Hadeeth to have particular circumstances and a specific context in which it was said.
Allaah Knows best.