This. Employers set conditions of employment. An employee doesn't have to agree and has a perfect right to work elsewhere. Some warehouse employers have banned cell phones on the work room floor. Because they facilitate employee theft of employer's time. Warehouse employees have complained; they have a right to go elsewhere to seek an employer that isn't as restrictive.Don't like the rules your employer has emplaced on its property? Go work somewhere else.
As to the 2A. The "at will" nature of employment (in all states except Montana) gives an employer the right to ban carrying firearms in the work place. Over the years, courts have ruled in support of at will employment restrictions. There have been many legal battles over "parking lot" employment rules, these have had multiple outcomes in the states. But the doctrine of employers being allowed to ban guns on premises is pretty solid.
I was a federal employee most of my working life. State laws had no jurisdiction there. Honestly, where I worked we didn't have much knowledge of a firearms ban on property until after the Edmond, Oklahome post office shootings. Suddenly, there was great emphasis on firearms possession. There were several employees who were gun people. We would occasionally swap guns in the parking lot during lunch. That came to a stop after Edmond. We were called into the office and given a verbal warning that we weren't to do this again. And we didn't. Many years later, there was an employee in another office who was a gun show trader. One Friday, he loaded up his stuff and kept it in his car at work during his shift for convenience. Somehow, the employer found out and he was terminated. The phrase our employer used was "immediate cause for dismissal." They didn't care about the circumstances. When you work in a system with vestment in a pension, that has an electrifying effect.
For employers, there are civil liability and OSHA workplace safety considerations big time. It's not necessarily that they are anti-gun. They are anti-lawsuit.