Well Muhammad lived with Jews and Christians, and they lived with him, all in the same city. They continued living there because they had an agreement, the Jews and Christians (mainly the Jews) would live in peace and security, be able to continue their trades, worships and cultural ritual. Some converted, many didn't- there was no compulsion to convert- the Muslim Holy Book disallows forced conversion. You can look up the Hudaibiya Treaty for more info on this.