We have laws against bank robbery. When a would-be thief decides to walk away from a bank because of the possibility of immediate consequences to bad behavior, we don't wring our hands and whine that the would-be thief is not thereby made into a saintly person. Society is pleased enough with the peaceful outcome regardless of why it came about. Laws against bank robbery do not rob would-be robbers of their free will choice on whether to rob or not. The existence of laws do not produce zombies unable to determine their own fates.
We need much more than mere human laws in order to have a healthy, functioning society, but the law does have an important role to play. Obviously, the ideal situation is one in which there are interior cops speaking within each and every individual. In such a scenario we wouldn't ever need any policemen or laws. We as a society can and should actively pursue policies and laws which foster the abilities of more and more people to be moral, self-governing individuals, such as discouraging self-destructive selfishness, hedonism, drug abuse, and other fashionable causes of moral-liberalism.