Answer by Henryk Bronislaw Hinkle-Zaleski Jr., commissioned officer as of 2010, one deployment in support of Operation Enduring Freedom, third generation armed forces:
It matters. Oh good heavens, does it matter. You cannot imagine the hell you would catch if you lost your weapon (or had it mixed up with someone else's). Generally speaking, you can catch this early by yourself, since your weapon has more distinguishing features than just the serial number. Personally, I like to have a forward grip on my M4A1, an ACOG sight if I can get one, although I'll take a properly calibrated red dot sight over the iron sights.
I understand why others want different configurations, I'm just more comfortable and accurate firing it that way. Since a lot of guys want all the whistles and bells, I can generally look at my weapon and say "Okay, forward grip, red dot sight, no flashlight, good to go." I don't have to look at the serial number every time, although I see it plenty when I'm cleaning my weapon. Cleaning, incidentally, is a daily chore, even when you don't fire, a country like Afghanistan just manages to get gunk in all sorts of places.
Now, what happens if you mix up your weapon with someone else's? Well, hopefully you noticed pretty fast, and hopefully it's somebody in your unit. Personally I'd start asking people to check their serial number right away and switch back as soon as I find the bastard who took mine by mistake. This happens all the time when you have weapons racks and places where you don't necessarily want to bring your weapon. For example, some forward operating bases require you to bring your weapon when you work out, some require you to lock it up first.
But ... Oh no! You checked with everyone and you still can't find your weapon!
It's about to get bad.
The first priority is locating your weapon. The military will literally shut down an installation to find an errant weapon. There is no stone they will not turn over, no length to which you will not be driven to find that weapon. They will recall everyone who was in your location for the last day, line them up, and read off serial numbers until they find it. I've seen people practically holding hands as they walk through the woods looking for a lost weapon. I've seen entire battalions placed on lockdown and forced to stay in their location into the wee hours of the morning, and they would still be there if the weapon were not located.
After that hell of wasting hundreds of people's time, keeping people from their missions or their families or their personal time, after making everyone so insanely mad at whoever was careless enough to lose their weapon, what happens to you?
You have no idea.
The very smallest punishment for misplacing a weapon, if it's found within a reasonable amount of time, is a "Company Grade Article 15." That means you can lose one grade of rank, a week of pay, and two weeks of extra duty. If that's all you lost, you got off very, very lightly.
More often, and especially if you lose your weapon in a combat zone, you're looking at a "Field Grade Article 15" if your chain of command is feeling very generous. You would risk losing at least one or as many as three grades of rank (E-4 to E-1), one half of your base pay for two months, 60 days restriction, 45 days extra duty.
That's only for enlisted though. If you do the same as an officer, you won't get the same slap on the wrists as a punishment. Your career is over. You may as well start looking around for a new job and hope you don't get a bad discharge.
So we check our sensitive items religiously. Normally there are two checks a day, and your gear is either on your person, or locked up somewhere secure. A lot of people tether their gear to themselves using a rope so there's absolutely no chance of losing something important. For attachments like scopes, you have to tether it to the weapon with a rope.
Accountability and personal responsibility for your equipment is something the military takes so seriously it's not even funny. Because if there's a fight, and you don't have your weapon, then you're a huge liability to everyone.
More questions on military: