Punctuation is important in any legal document because it changes the meaning in one way or another.
The courts have ruled that in the 2nd amendment the second comma divides the amendment into two clauses: one 'prefatory' and the other 'operative.' The bit about a well-regulated militia is just preliminary throat clearing; the framers don't really get down to business until they start talking about 'the right of the people ... shall not be infringed,..
However, it is has also been successfully argued in court that the use of commas was far less restrictive in 18th century; that is writers liberally used commas between most all clauses thus the primary two clauses were a conditions for the operative clause, "shall not be infringed...".
One can argue this point either way but the fact is the 2nd amendment was a compromise between states who favored a strong standing army and states who simple wanted local militias. So just as today, the two sides could read the amendment as favoring their belief.
Today 60% of gun owners state that protection is the reason they purchased a gun. 38% said it was hunting. Those were certainly not the reasons the founders put the 2nd amendment in the Constitution. Guns in those days were muskets without a rear sight that were certainly not very useful for hunting or protection. There only really practical use was in being fired in volleys as in militias.
Unlike today, the approval of the 2nd amendment was not a news worthy event because most people had little interest in owning guns. Only 1 in every 5 households owned a musket and few people had any interest in buying one since the cost was 2 weeks to a months pay. Most muskets were passed down from father to son and were not well maintained. In fact, a survey at the time done by a North Carolina militia found that over half were inoperable. They also had no rear sights making them very inaccurate and loading time for most people was 30 seconds to a minute. Thus, a good knife or axe was much better self protection at a fraction of the cost of a musket.
I wouldn't put a whole lot of stock in punctuation from a 200+ year old document, and I'm a proofreader. Commas were used more or less indiscriminately in that less-linguistically refined period, which also displays the old German practice of capitalizing nouns ("Militia"... Security"... "State"... etc). Language evolves over time, and the "proper" use of a comma and what it means or doesn't mean wasn't nearly as meticulously defined as it came to be.
The adjective "prefatory" though, is pure absolute snow-job
bullshit. All "prefatory" means is that it "comes before" or "introduces" another part (as in
preface). We can already see that it come first, so "prefatory" tells us absolutely nothing of what its
function is. And that's an enigma; the introductory phrase "a well regulated Militia being necessary to the Security of a free State" has no discernible reason to exist. A Constitution has no need to
argue its case for why it sets out what it does; it simply declares "these are the rules". There's no point in
rationalizing the Amendment as if it were part of some debate, nor does any other Amendment do so (nor should it), so the presence of the clause remains a head-scratcher.
Ultimately the presence of a subordinate clause that seems to want to argue its existence looks like either sloppy or unfinished work, or both. If it's intended as a limitation, which is the only conceivable direction it would have wanted to go, then it's poorly written as such.