There are a number of factors that might motivate actors in the criminal justice system to engage in unethical behavior. Let us look at a few of them.
First, they may become disillusioned with the world in general. People in this system spend much of their time around people who are extremely unethical. They may come to have a very jaded view of the world in which they feel that everyone in the world is unethical. They may feel that there is no reason for them to remain ethical in such circumstances.
Second, they may come to be disillusioned with the way in which they are treated by society. Their jobs are very stressful and are not very high status. People do not always treat them well. They may take their frustrations out on those that they interact with on a daily basis. They may come to feel that society is not worth working hard to protect.
Finally, these people are exposed to much more temptation to be unethical than the vast majority of other people are. They are constantly exposed to situations in which unethical behavior would be possible. There are all sorts of people who are willing to bribe them. They are often in the presence of people that they can take advantage of because they have much more power than those people.
For these reasons and others, unethical behavior can arise among people in the criminal justice system.