Unless you have an employment contract or union agreement that probits this action, it is legal. A company can set the conditions of employment much as it sees fit in an "at will" work arrangement (absent legally actionable discrimination). This includes who to fire and why. In fact, a worker can be terminated for any reason or no reason at all. And think about, if a gun is brought onto company property it can be held liable for any accidental or intentional use, not to mention it wants to maintain a safe work environment.