During the time the Constitution was written, the United States was still young and undeveloped. The reason for having firearms was for Mass shootings security, as that they had little in the way of planned protection which could cover every community.
It has been over 2 hundred years since that day and the United States of America changed, for the better.
With nearly 18,000 police stations around the world, and over 1,300,000 soldiers active at any moment, the United States is well protected.