Section 5 of the Insurance Act, RSBC 2012, c. 1 provides that the insured committing an illegal act not intended to procure an insured loss will generally not prevent recovery under an insurance policy:
Unless a contract otherwise provides, a violation of a criminal or other law in force in British Columbia or elsewhere does not render unenforceable a claim for indemnity under the contract unless the violation is committed by the insured, or by another person with the consent of the insured, with intent to bring about loss or damage, except that in the case of a contract of life insurance this section applies only to insurance payable under the contract in the event the person whose life is insured becomes disabled as a result of bodily injury or disease.
(Insurance Act, RSBC 2012, c. 1, s. 5, emphasis added).
As discussed in the fortuity section above, a loss is only insured if it is the result of an accident (i.e. it is unintended from the perspective of the insured). The Supreme Court of Canada has commented that the issue of whether a loss is fortuitous is the same as whether the loss was the result of a criminal act intended to procure the loss:
In my view, the test laid down by the statute namely, whether or not something was done by or for the insured “with intent to bring about loss or damage” is the very same test which must be applied to decide whether the occurrence is an accident or whether it is a crime barring recovery.
(Canadian Indemnity Co. v. Walkem Machinery & Equipment Ltd.,  1 S.C.R. 309 at 317 - 318).
The opening words of s. 5 of the Insurance Act (i.e. “Unless a contract otherwise provides…”) are important and indeed a contract of insurance may state that no indemnity will be provided if the loss arose from a criminal act committed by the insured. In Scott v. Wawanesa Mutual Insurance Co.,  1 S.C.R. 1445 the insureds’ 15-year-old son intentionally burned down the family residence. The son was an unnamed insured under the policy and the policy contained an exclusion for:
… loss or damage caused by a criminal or wilful act or omission of the insured or any person whose property is insured hereunder.
In a four to three decision (two vacancies in the Court) the Supreme Court of Canada concluded that because the son was an insured and had committed a criminal act the exclusion applied and the parents’ claim was consequently disallowed.
Illegality comes up in various contexts and those will not be discussed in this part of the website which merely provides an overview of insurance principles.