Moses laid down implacable laws for his people: an eye for an eye, a tooth for a tooth. The slightest misdeed had to be punished – there could be no question of leniency or forgiveness.
But that was understandable, since humanity’s degree of evolution was such that it needed strict rules; people still had to learn about justice. In fact, at the time, justice constituted a considerable step forward.
But this situation could not last forever. God is compassionate and merciful, and like Him, human beings had to become compassionate and merciful too.
This is why Jesus came to teach forgiveness. Think about how he treated the adulterous woman whom the Pharisees wanted to stone: his attitude was a breach of the law of justice, but in breaking the law of justice, Jesus instituted the law of love.