Most prosecutor's offices hire attorneys on an "at-will" employment basis, which means that the employment can be terminated at the will of the elected official. Which means that if the boss doesn't want you to own a gun, and you do anyways, you can be fired. Not a 2A issue, as the 2A only protects the right to possess, not the right to continued employment. So, if you want the job, you make the choice. Same if the prosecutor used his 1A rights to express that drugs should be legalized, and the elected DA could fire for that statement.
(Note, I don't think this is morally right, but it is legal. And as a former prosecutor, I wouldn't do the job without having firearms. Too many enemies made along the way...)