It's not a law, it's an acknowledgement of an inalienable right, and it only spells that you to prevent the government from restricting it, so that should the government become non-representative, as it was in 1776, we have the ability to overthrow it again.
It's only that way as long as the government chooses to keep it. It's an amendement to the constitution and these can be repealed with another amendment. Prohibition is the obvious example, enshrined in the constitution by amendment XVIII and repealed in amendment XXI. It was of its time and in hindsight not a great idea. To pretty much everyone else in the western world, and an increasing number of people in the US, the same can be said of the 2nd amendment.