If you must go through another country (other than your own) on your way to Canada (e.g. stopover, connecting flights, etc.) you may need to obtain a transit visa for that country, even if you are not leaving the airport.
United States of America
If you need to make a stopover in the United States, you must be authorized to enter U.S. territory.
As of January 12, 2009 all citizens or nationals of a Visa Waiver Program (VWP) member country must obtain approval through the Electronic System for Travel Authorization prior to travelling to the United States by air or by sea. If you are not a citizen or national of a VWP member country, you must apply for a U.S. transit visa.
If you need to make a stopover in a country other than the United States of America on your way to Canada, check with that country’s embassy about whether or not you need a transit visa.