How long does it take?
As little as 18 months via an "academy" program or 4-5 years if you go to an aviation university and them have to build up flight experience.
What do you have to do to become a pilot?
1. Get your pilot certificates and ratings via a flying club or school at the local airport, a university aviation program. A newly certificated commercial pilot with instrument and multi-engine ratings usually has about 250 hours. This is not enough for the airlines*. (See note* at bottom)
2. Build up flight experience until about 1,000 flight hours. Most regional airlines require pilots to have at least 1,000 hours of flight time, with 100 of that being in multi-engine aircraft and a Commercial/Multi/Instrument certificate. (An Airline Transport Pilot certificate is not required until you make captain.) Common time building jobs are: banner towing, skydive pilot, pipeline patrol, traffic watch or flight instruction (with the additional Certified Flight Instructor rating)
3. Get a degree. You do not need a degree in aviation, but having a degree in any subject is a requirement to getting hired on at a major airline. The regionals aren't so picky. Many think they must have an aviation degree to have an edge but when or if you are ever furloughed during your career an aviation degree is useless.
4. Upon reaching the magic 1,000 hours begin applying! Hopefully you will get hired. Learn to live on a budget as regional airline pay is not very good. After building up about 2,000-3,000 hours and "paying your dues" at a regional you then qualify for a job with a major carrier.
5. Begin applying all over again.....
* There are some airline academy programs (Delta Connection Academy, Mesa Ailines Pilot Development, Flight Safety among others) that offer a "quick entry" scheme into the right seat of a regional airline. They are very costly and do not guarantee a job, but an interview only. If you pass their program and the airline interview, you could very well be hired as a First Officer at 300-400 hours. Some are very pro this method while others in the industry are not as they feel it's "buying a job". Some academy grads will face discrimination during their career because of this.
See these links for more info & explainations-
How much money do they make?
Read this previous answer that addresses that topic-