Oh no, it very much is! This should give you an idea how real this is:
Military Involuntary Separation Pay Charts
See. it really does not matter what you believe. Especially since you claim that you are not familiar with military enlistment (as well as separation). Maybe next time you will do a little digging before doubting.
And the programs above really only scratch the surface, there are even more.
But no, the military can not just cut you loose and discharge you early without cause. The servicemember and the Government are in a legal contract after all. Now you can be cut loose earlier than that with cause. This includes medical disability, family hardship, failure to adapt, or outright misconduct and criminal behavior. And depending on what caused that separation, there may be a separation pay issued.
You may be thinking of draftees, who entered the service under very different circumstances. During times on conscription, the term of service is actually a much more vague "duration plus six months". That means that the military can hold all individuals for up to six months after the conflict has ended, there is no actual set time period for the enlistment. It may be 1 year, it may be 8 years.