People in power decide what is wrong. It is an arbitrary system but one that we all have to live with. Moral and religious leaders as well guide are sense of eight and wrong.
No system is perfect but it is necessary. Just having laws as morals isn't enough. It sets up a system where by people who are not caught are in the right.