It is allowed to take the oath as long as it does not entail disobedience to Allah. For example, the oath of citizenship for the USA in 2020 was: “I hereby declare, on oath, that I absolutely and entirely renounce and abjure all allegiance and fidelity to any foreign prince, potentate, state, or sovereignty, of whom or which I have heretofore been a subject or citizen; that I will support and defend the Constitution and laws of the United States of America against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same; that I will bear arms on behalf of the United States when required by the law; that I will perform noncombatant service in the Armed Forces of the United States when required by the law; that I will perform work of national importance under civilian direction when required by the law; and that I take this obligation freely, without any mental reservation or purpose of evasion; so help me God.” The first amendment to the US Constitution also states: “Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof…” Therefore, since there is a lot of room for interpreting many of the statements in the oath, it will not entail disobedience to Allah and is therefore allowed.
What the Qur’an and Sunnah Say
The Prophet said, “There must be no obedience in disobedience [to Allah].” (Bukhari #7257)
Shaykh Mustafa Umar