When you join the military, it is done as a contract. X number of years in a given career. My first tour was 5 years active and 3 inactive. I reenlisted for another four years so in the end I did a bit over 8 years of active service. When I got out of the active service I joined the National Guard who had similar tours of service.
As for if you can leave when you are already in it, well No! You can be asked to leave, or as we like to call it, get thrown out but that normally is because you have messed up royally. Also there are consequences for getting thrown out. You can be made to repay the government for bounces, or paying off your student loans. Not to mention the normal loss of pay that comes with the administrative disciplinary action.
Trust me it is best to think good and hard about reenlisting and leaving with an honorable discharge. For more information consult a recruiter.
If you leave the military, simply by walking away, they will track you down and arrest you. There are several types of separation from duty. Honorable Discharge means you did everything right. There are others, such as General, Medical, Dishonorable. Job applications for all types of jobs ask about military service record. If you have anything other than an Honorable Discharge, it can keep you from getting certain jobs. If you have reservations, this might not be the thing for you to do. It takes a lot of courage to give somebody total control over your life. I admire the many people who have done so. I did not feel ready to make that commitment right after HS, although I later considered going in as an officer.
If your school has an ROTC program, you may want to try it out to get a glimpse of the military lifestyle.