If this is your first car, yes, you'll have to buy auto insurance before you drive your new car off the dealer's lot. If you are financing the purchase, the lender will require that you buy a policy with comprehensive and collision coverage.
CarInsurance.com now offers insurance at all dealerships.
If you are at a dealership or wanted to compare prices get an auto insurance quote here.
If you already have an auto insurance policy, and you are replacing a vehicle it will generally cover your new automobile for a few days (regulated by each individual company and/or state). Once that period is up, verify with your insurance company to confirm that the new vehicle has been added to your policy.