The general purpose of the law was to "protect the state interest and the foetus", which was sufficient to invoke the criminal law power under the Constitution.
The purpose of the law was to protect both the state and the fetus, a justification that allowed for its application under the Constitution's criminal law powers.