The existence of the laws doesn't prevent crime or create it.
Technically both of these are wrong.
Laws in theory create crime because if there was not a law against something, it would not be a crime to do that thing. So if you create a law that makes something criminal, you are now creating crime.
In terms of prevent crime, laws don't prevent
all crime but they do substantially minimize the probability or likelihood of someone committing a crime strictly out of fear. For example, if drinking while driving weren't a crime, many more people would do so without fear of repercussion and the possibility of issues happening in their own life (eg. jail time, losing job, losing license, etc.). But to my point, if DWI wasn't illegal, it would not be a crime to do so, so now that the law is in place, the law effectively created crime.

I will say, if someone wants to commit a crime or do something of that nature, they
will find a way.