It is amazing to consider that basic training doctrine has changed over the course of time. Back when I was in uniform we were issued (take what you were handed - no such thing as "yours" for the duration") clubs and spears only when we were at the dinosaur range, working civil disturbance and rights violation duty, or actually in a combat theater. On all other occassions it was as if our battle weapons did not exist.
Shufle forward to the current time, where recruits are issued their very own rifle on either day 2 or day 3 and carry it around everywhere, including the latrine and the shower. Of course, they never get their hands on boolits or something to make one end pointy, but that's a different story altogether.
Once the recruit has been graduated there is another phenomenon that comes into play - the same one that existed back in my day too. That is that the civillian population has a wee tad bit of fear that if soldiers/Marines are allowed to carry weapons around all the time, someone in the chain of command will start wanting to find a reason for using them. (Agreed there is a separate danger of Willie and Joe doing stupid stuff to each other and the countryside if they ever gor their hands on real boolits, but that can be controlled to a significant degree by locking up issue stuff and doing locker and vehicle inspections to see they are not bringing any back from the shops in town.)
The troops are issued long guns periodically so that someone can wear them out a bit and keep them busy either doing close-order drill or cleaning the bejabbers out of them (ever wonder why bores of barrels on training/garrison arms are worn out without ever being shot?). Other than that they either go for long walks in the woods and play Boy Scout without being allowed to start fires, or walk around picking up cigarette butts until someone can find a war to send them to.
Seriously, have you ever visited another country (except Isreal*) and seen the troops walking about with battle rifles slung over their shoulders? It can be very worrying to wonder why the .gov of that place feels it is important forarmed troops to patrol the streets. It made me want to get back home rather than stick around and see what happened next.
[* Isreal getsthree breaks - 1) because they have so many hot women in uniform that having them carry M-16s just makes them hotter; 2) even when they (men as well as women) carry their M-16s the magazine can only be rubberbanded to the weapon - never inserted until ordered to do so; and 3) goven the number of folks who visit Isreal with the intent of killing the inhabitants it just makes sense.]