Imam al-Shafi'i (may Allah have mercy on him) said: "So whenever he is able to leave it (the abode of war), he should leave, because his oath is the oath of one under compulsion."
He (further) said: "And perhaps it is not permissible for him to remain with them when he is able to separate from them."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / Q18419
Sayyiduna Jarir bin Abdullah (may Allah be pleased with him) said: The Messenger of Allah (peace and blessings be upon him) sent a detachment towards the tribe of Khath'am. Some people sought protection by prostrating, but the men of the detachment hastened to kill them. When this reached the Prophet (peace and blessings be upon him), he (peace and blessings be upon him) ordered that half the blood money be paid and said: "I am free of responsibility for every Muslim who lives among the polytheists." They said: O Messenger of Allah! Why? He said: "Their two fires should not see each other."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18419
Sayyiduna Samurah (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "Do not live among the polytheists and do not associate with them; whoever associates with them or lives with them is not one of us."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18420