Some jobs are haraam in and of themselves, such as working in riba-based banks and places where alcohol is sold. Some may be haraam because of things in the work-place that are contrary to sharee’ah, such as mixing between men and women, or because it is stipulated that one should wear haraam clothing or do other things that are contrary to sharee’ah, such as shaving the beard. It is not permissible for the Muslim to do either type of job.
Jobs of the second type vary in the degree to which they are haraam. The one which incurs the greatest burden of sin is that which involves writing down or recording riba (usury), then that which involves selling or manufacturing haraam things, then that in which the workplace environment is haraam. The last category should not be taken lightly, because it has an impact on the religious commitment and conduct of the worker, especially the fitnah of women which was the first fitnah of the Children of Israel and is the most harmful fitnah for the Muslim man, as our Prophet Muhammad (peace and blessings of Allah be upon him) told us.
If mixing between men and women is something that happens in your country and you can hardly find any job that is free of that, and you think that your being in that job will be beneficial and that you will be able to put a stop to some of that evil and reduce some of it, and you will be able to advise the employees who are under your authority, enjoining them to do what is good and forbidding them to do what is evil as much as you can, and you can take precautions and measure which will help you avoid the fitnah of women – such as hastening to get married if you are not married, not looking at them or being alone with them – and if the work requires you to sit with some of the female employees you can leave the door of the office open and not sit close to them and so on …
… then we think that your being present in the workplace and achieving some of the interests of sharee’ah and reducing some evils, is better than keeping the workplace devoid of the righteous and leaving it to those who do not pay any attention to religion or to the rulings of sharee’ah, so that these evils become more widespread and it becomes more difficult to fight them. How many teachers and university professors have taught in mixed institutions and Allah has benefited many through them, and warded off a great deal of evil.
We hope by Allah’s grace that you will be one of them.
However, if you think, after taking the job, that you cannot adhere to your religious commitment and that you are being pulled into haraam gradually, then you have no choice but to leave that job immediately. If a person gives up something for the sake of Allah, Allah will compensate him with something better than it, as the Messenger (peace and blessings of Allah be upon him) said.
With regard to the ways in which the Sahaabah (may Allah be pleased with them) earned their living, there were many ways, including:
· Trade, as in the case of Abu Bakr al-Siddeeq, ‘Uthmaan ibn ‘Affaan and ‘Abd al-Rahmaan ibn ‘Awf (may Allah be pleased with him)
· Agriculture, whether they owned farmland or worked on the land; many of the Muhaajireen and Ansaar were involved in this
· Skilled crafts, such as smithery, carpentry and so on
· Jobs that were connected to the state, such as teaching, collecting zakaah, judging and so on
· Earnings acquired through jihad, such as war booty
But there is a great difference between the nature of life, professions and handicrafts at that time, and these things as they are nowadays. But every era is different, as they say.
And Allah knows best.
(Source - Islam Q and A)