That’s possible to do, even for a low-ranking Soldier. It depends on a multitude of factors, the most prominent one being how closely the company armorer tracks his arms room inventory before closing up for the day. Obviously that commander has some ‘splainin’ to do.
In the German forces, nobody gets off until the unit armory is counted and safe. When I was in deputy CO, it was the most important thing to ask in the late afternoon: “armory closed, counted and safe?” So I can imagine, the offender took the gun over the day, made it somehow off the base and kidnapped his ex.