They can court martial you, hit you with insubordination beforehand, delay the paperwork, all kinds of fun stuff, because despite being a volunteer army, you sign an enlistment contract and unlike at-will employment that gets pushed everywhere else to combat unions, there can even be financial consequences for trying to leave your contract early.
It's why I heavily discourage people from joining the military, other than all the usual reasons. At least you can quit McDonalds.