Why are there in history so many cases of violating ten commandments by religious people? Such as slavery, wars, violence...
There is, of course, no way to know the answer to this question with certainty. We cannot prove why people act in ways that are immoral or wrong. I would argue, though, that it is simply because of human nature.
Let us consider the idea of the Ten Commandments. These are supposed to be the laws that God wants to impose upon people. This implies that the things that are being prohibited are things that people really want to do. There is no reason that God would have made laws to prohibit things that people did not want to do in the first place. We make laws to stop people from doing things that they want to do which are contrary to what we think is best for our society. God, presumably, makes laws to stop people from doing things that are bad for them, even if those are things that people really want to do.
If this is true, it must mean that we are driven to want to do many of the things that the Commandments prohibit. Since we are weak and fallible, this means that, over the course of history, we will see many examples of people faltering and doing the things they want to do even though God has prohibited them. It is, in other words, our nature to want to violate these commandments and therefore we do so with distressing frequency.