There are lots of laws that are not considered immoral on their own, but are enforced due to practical constraints on determining risk. Driving a car without a license is not an immoral act if someone posses the training and skill and carefully applies these. However, determining the individual case risk becomes practically impossible and thus we make driving without a license illegal. The same goes for construction permits, business and contractual law, etc.
Similarly, things with very high risk of long term negative effects to the society or the individual are made illegal due to the risk and not due to the immorality of the event itself, such as our drug laws.