All initial contracts are for 8 years. If you are going active duty, the Marine Corps generally has 4 year active followed by 4 years in either the Marine Corps Reserve or as a member of the inactive ready reserve (irr). IRR is basically a list of service members who can be recalled to active duty if needed. At the beginning of Operation Enduring Freedom and Operation Iraqi Freedom, there were a number of individuals who were recalled in order to fill shortages. Recalls are based on your MOS and the needs of the military. However, the military is getting its quotas of recruits so the necessity of recalls is not nearly as great as it was 4 or 5 years ago - still happens in critical mos's but far fewer.
You typically have to stay all 4 years. Sometimes you can get out early if the military is going through a reduction in force. However, the Marine Corps is a small force to begin with so they rarely let people go early without a reason such as injury, illness or discharge for cause (not a good thing!). You really do not want to leave prior to your 4 years for a couple of reasons. First is that in order to get full gi bill benefits, you have to have an honorable discharge and you must have 36 or more months of active duty service.
As far as the training, the Marine Corps is challenging. Your basic training is 12 weeks as long as you are not recycled (sent back). I believe that SOI is about 4 weeks. You may have additional training if you are selected to fill certain positions in an infantry platoon or if you are selected for sniper school. You will learn small unit infantry tactics and how to be a Marine. Your training, however, does not end with SOI. You will continue to train with your unit when you are assigned to a unit. Basically Marines are either training to go to war or they are in war. It is a cycle.
If you are not sure about staying in the Marines or would prefer a 3 year enlistment, check with the Army. Also, make sure that you really want to be infantry. Think about what you picture yourself doing when you get out. The Marine Corps, along with other branches, has lots of jobs. Some jobs actually provide decent training that would transfer into the civilian world. Speak with a recruiter and ask lots of questions. Also, speak with recruiters from other branches to make sure that they are not offering something that you may be interested in. If you sign a contract and ship to basic, you are obligated to serve your time so make sure that it is something that you really want to do and make sure that you understand what you are getting yourself into.