What about a thousand years? This question was asked before about planes (I think), but since a gun is considerably less complex than a vehicle, I was wondering if they'd stand the test of time. Or would you need to build new, more primitive guns?
A well-maintained firearm can last for generations, but the key is maintenance. I personally own several weapons that are more than a century old and still fire quite well. I completely anticipate they will continue to do so for another 100 years, but only if my descendants take care of them as meticulously as myself and my forebears.
The reason there is need for this constant care is rust. All firearms have a barrel made of steel. Steel is very susceptible to rust under even the best conditions. Most weapons have some sort of rust protection, like zinc plating or bluing, but these need constant attention or else they will weather away, exposing the vulnerable steel beneath.
Some weapons (read: pretty much all of them) also have non-metal parts, made from wood or some synthetic material. With constant care, the wood might also last as long as the metal, but it also might not. Certain synthetics show some longevity, but they will also degrade eventually.
Even if the weapon in question was well maintained for the entire course of time, we have the problem of ammunition. Even under the best storage conditions, ammunition has a shelf life well short of our proposed timeframe. Casings, bullets, primers, and even powder (ALL of the requisite components) will break down, rust, or erode over time. If it DID manage to survive (unlikely) it would be questionable, and firing it would be dangerous at best.
Optimistically, I can imagine that in 500 years from today, assuming life continues as it is, there may be a small handful of operational 20th century weapons in the hands of collectors. Most likely there would be zero. Assuming the world goes to hell in a handbasket, the chances are even slimmer.
A few years ago a centuries-old loaded cannon was found in New York. CNN reported that the gunpowder was still "active". Unexploded ordnance that is almost 100 years old is still dangerous, so caution is surely indicated.
On the other hand, the mechanism of a modern semiautomatic handgun is much more complicated than a muzzle-loading cannon. Look at the pic in the New York case.
- The most likely result in your case would be that the trigger and firing pin don't work.
- If the pin works, the next most likely result is that the primer and propellant don't work.
- If the propellant works, the weapon might be damaged, the bullet might get stuck in the barrel, the slide might crack, whatever.
- If the bullet gets fired, which is extremely unlikely, accuracy will suffer.
- Also, the likelihood that the semiautomatic will chamber another round is very low.
They would work in the right situations, but I wouldn't trust them to fire very well, if at all. It would require a controlled environment, preferably with humidity control. A sealed vault could hypothetically keep it working. It's not really a matter of the gun itself, since stored properly artifacts will last forever (yes, guns require maintenance, but historical artifacts in vaults don't). But ammo itself goes bad. This usually doesn't happen for a couple decades, but I doubt nitrocellulose would last that long. Ammunition from the 50's can still be used, but improperly stored ammo can go bad. Even properly stored, 500 years is a bit of a stretch, and you might have to go through a bunch of non-firing bullets before finding something that works.
A normal diesel emergency generator in a similar hypothetical environment, maybe a sealed off vault, could work, and it wouldn't take too much to just scrape together spare parts from different generators and replace the ones that failed.
No, not even close
Pistols as well as most guns are made of stainless steel. Many other compunds are needed to make a working gun, such as copper, zinc, gunpowder and other assorted alloys. The main problem here is the steel. In which it will last 10 years of a reasonable rust free life assuming its zinc plated. Whereas austenitic stainless steel fasteners will give at least 30 years trouble free life for most applications. So short story even shorter, no the gun won't even last 10% of your goal.
What I believe is the as yet unanswered part of your question, "Can you...", no I will be dead by then!!!
Next, could someone alive then? Sure they could, it might fire, it might not - though I agree with one of the other comments, one of the more interesting cases might well be a 'printed gun' out of plastic. No rust, no maintenance. As others have noted, the ammo might not function though.