CBP recommends that you apply at least 72 hours before travel, you may apply any time prior to boarding. In most cases, a response is received within seconds of submitting an application.
ESTA is not a visa. It does not meet the legal requirements to serve in lieu of a U.S. visa when a visa is required. Travelers that possess a valid U.S. visa may travel to the United States on that visa for the purpose it was issued. Travelers traveling on valid visas are not required to apply for an ESTA. In the same way that a valid visa does not guarantee admission to the United States, an approved ESTA is not a guarantee of admission to the United States.
The Electronic System for Travel Authorization (ESTA) is an automated system used to determine the eligibility of visitors to travel to the United States under the Visa Waiver Program (VWP) and whether such travel poses any law enforcement or security risk.
Canadians don't have to do this, which is why you have likely never heard of it.
What is an Esta?
Electronic System for Travel Authorization. Basicially it's a virtual Visa application to enter America.
https://help.cbp.gov/app/answers/detail/a_id/1072/~/about-the-electronic-system-for-travel-authorization-%28esta%29
https://esta.cbp.dhs.gov/esta/
The Electronic System for Travel Authorization (ESTA) is an automated system used to determine the eligibility of visitors to travel to the United States under the Visa Waiver Program (VWP) and whether such travel poses any law enforcement or security risk.
Canadians don't have to do this, which is why you have likely never heard of it.
Electronic travel authorization for travelling or transiting to US