All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
In principle, what is considered concerning the ruling on a job is the nature of the work itself, and not the country and its law. Permissible jobs –such as medicine, or construction, or other – remain permissible even if the country is governed by non-Islamic laws.
Indeed, the work that is related to the laws that contravene the Sharee'ah and contradict its principles that are confirmed with absolute evidence, such as working in the judiciary sector, prosecution sector, and so on, then in principle, the ruling about this is that it is not permissible to work there because they are directly involved in judging by other than the Sharee'ah, directly supporting such verdicts, or approving of it.
However, a person may be allowed to do this type of work due to necessity and the like, or if one takes the job in order to reduce injustice and reduce corruption as much as possible.
The prominent Imam Ibn Taymiyyah issued valuable statements in this regard, giving inference to the story of Prophet Yoosuf about his work with the King of Egypt –who was a non-Muslim, and the story of An-Najaashi after he became a Muslim, as he continued as a ruler over his people despite their disbelief because they did not allow him to judge amongst them according to the Islamic law.
As for working in defense of countries that judge with man-made laws: If it is a defending the oppressed against their oppressors and offenders, without doing injustice to others, then there is nothing wrong with it. However, if the work in defense involves injustice and transgressing against others, then there is no doubt that it is forbidden.
Allah knows best.