This depends heavily on your specific role and how directly it connects to the impermissible activity. Scholars generally distinguish between working in a role that is itself lawful within a company that has some unrelated impermissible income streams (for example, an accountant, IT worker, or receptionist at a large conglomerate that has a small non-compliant division), versus working directly in the prohibited activity itself (for example, serving alcohol, processing interest-based loans, or underwriting gambling products). The Quran instructs believers to cooperate in righteousness and piety, and not to cooperate in sin and transgression — a principle scholars apply directly here. A Muslim working as, say, a security guard or cleaner at a bank is in a more lenient position than a loan officer structuring interest contracts, since the latter is directly performing the impermissible act. When a job is unavoidable due to necessity (supporting one's family with no immediate alternative), scholars generally advise continuing while actively seeking halal alternatives, minimizing direct involvement in the haram element where possible, and not treating the situation as permanently acceptable.
Q&A · Business & Finance
Can I work for a company whose business isn't fully halal?
References
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.