There is nothing wrong with working in an insurance company as a medical officer. Your job as a medical officer has nothing to do with the legality of insurance - if your duty is solely concerned with providing essential healthcare services for those involved.
It is akin to treating patients who approach you for treatment when you work in a clinic or hospital. Your medical ethics demands that you treat everyone regardless of how and why such a medical condition resulted.
As long as your work is treating the patients, there is nothing unlawful about it.
According to the rules of jurisprudence, “We are not questioned about what happens behind our ken of perception.”
If however, the duties may entail concocting or forging false certificates to protect the insurance company then you ought to refuse the job. It is akin to bearing false testimony which as the Prophet reiterated is the third of the most heinous sins. The Prophet (peace be upon him) said, “Shall I tell of the the three most abhorrent sins - he repeated the words thrice, then he said, “It is to associate partners with Allah; to displease one’s parents and to bear false testimony, and he repeated the last words three times, again.”(Reported by Bukhari on the authority of Nufa'y b. al-Harith)
So, I would urge you to judge for yourself by considering the specific duties entrusted to you as a medical officer of the insurance company.