No, but it lets you punish people that do them. No one is under the assumption that outlawing something means that it will never happen, and implying that people breaking the law means that the law is useless is asinine.
If we believed laws had zero effect on behavior, society would be a lot different.