According to the Alberta Institute, it isn't unconstitutional because:
the "notwithstanding clause" is Section 33 of The Canadian Charter of Rights and Freedoms, which itself makes up part of our Constitution.
It is a cornerstone of Canada’s constitutional framework, designed to protect the provinces and all Canadians from judicial overreach.
"Parliament or the legislature of a province may expressly declare in an Act of Parliament or of the legislature, as the case may be, that the Act or a provision thereof shall operate notwithstanding a provision included in section 2 or sections 7 to 15 of this Charter."
And provinces would not have signed the Constitution without that clause.