Who Does the Law Apply To?
The law applies to everyone in Canada, whether you are a Canadian citizen, a permanent resident, or a visitor. If you break a law in Canada, your immigration status could affect the kind of penalty you receive. If you are not a Canadian citizen, for example, and you are found guilty of a crime, you could be deported. This could affect your ability to enter Canada in any capacity in the future.
It is your responsibility to know and obey Canadian laws if you are planning to come here. Even if you break a law because you did not know about it, you will still be penalized for it. Ignorance of the law is not an excuse for breaking it.