Carpooling is 100% legal
According to the Canadian Transportation Act, carpooling is perfectly legal with respect to 2 criteria:
1. The driver would have made the same or similar trip
2. No compensation in excess of the cost reimbursement is required
Read more about carpool legality