1) All your competitors have to follow the law too, so it's just another cost of doing business.
2) Women are having children later, generally, so employers will see a 25-year-old and think "eh, I probably have 5 years at least".
3) Men are starting to take more parental leave, and the law is mostly gender-neutral (there is some amount of leave specifically for mothers who have given birth, but most can be taken by either parent). In fact, both parents can take the leave and have their jobs protected, although you can't double-dip on the paid benefits. I took three weeks off at my daughter's birth and 3 months when she was ~9 months old.
4) Maternity leave coverage is a great way to try out an employee for a year - hire Jim to cover for Jane, if you like him keep him on after the year, if not he disappears. (Part of this is Canada is more resistant to the contractor/employee trend than the US).
5) The people doing the hiring are likely to either have children or will in the future, so they feel like it's a reasonable/good policy.
Nothing blows my mind as much as hearing Americans talking about maternity benefit. I was listening to a podcast and one person said "we were lucky to have such good maternity benefits, I didn't have to go back to work for 6 weeks" and I was floored.
Here in Belgium maternity leave is actually quite short, but you have the option to extend it for many months albeit at a reduced pay (provided by the govt). Not everyone can afford to extend it. Dads can also get paternity leave, up until the kid is 12yrs old.
Gender roles are changing a lot, paradoxically me as the father / chauffeur of the family is the one who has to leave by 5:30PM every day to get to day care on time while my partner doesn't have that limitation on her working hours.