If you're late for work in the military, you can be charged UA (Unauthorized Absence). When I had to work at the brig for a month, there was a guy in there for being 37 minutes late to work. Imagine being late for your job and have to go to jail because of it.
Now if you didn't show up for 30 days, you were considered a deserter. The punishment I've seen for that was anywhere from 1 to 2 weeks in the brig, then you're placed on barracks restriction (pretty much the same as house arrest) until you were processed out (or if you were given the chance to finish the remainder of your contract). Usually it took 60 to 90 days to process a person out of the military.
Being a former MP (Military Police), we had to deal with a lot of deserters coming back (even guys from Vietnam).