Radioactive isotopes eventually decay, or disintegrate, to harmless materials. Some isotopes decay in hours or even minutes, but others decay very slowly. Strontium-90 and cesium-137 have half-lives of about 30 years (half the radioactivity will decay in 30 years). Plutonium-239 has a half-life of 24,000 years Most nuclear weapons these days have a reservoir of Tritium gas, which is a radioactive isotope of hydrogen. The half life of tritium is about 12 years, so the reservoir needs to be periodically replenished to maintain reliability.
Plutonium is very active, decaying at a high enough rate to actually heat itself up significantly. Little is known about the effects of long term radiation damage on plutonium metal, and when coupled with the sustained high temperature, it's conceivable that adverse changes in the crystal structure could take place.
Nuclear weapons are full of unstable material. in most modern weapons, insensitive high explosives are used, but they are exposed to decay heat and a constant stream of gamma radiation from Pu-240 impurities in the bomb's core- this can lead to expansion and cracking of the explosives, damaging them and preventing the bomb from yielding the proper amount. 435
Also, the explosives decay over time; both of these effects necessitate replacement of the explosives.
The bomb's pit (the core) is typically plutonium; plutonium is radioactive and is constantly decaying, and as such microscopic helium bubbles form in the pit, and can affect the symmetry of the core's implosion. Also, the aforementioned decay heat can warp the metal, and radiation from decay can damage the crystalline structure of the pit- plutonium has six common allotropes, and radiation/heat can cause the metal to change allotropes. All of these effects require the pit to be reformed every once in a while.
Modern bombs use tritium boosting gas. Tritium has a half life of about 12 and a quarter years, and as such must be regularly replaced to maintain the ability to yield properly. While nuclear weapon maintenance schedules are obviously classified, those two items probably give you a ballpark estimate of a few years or so. While an unmaintained warhead might still fire, the yield could be significantly reduced. A weapon sitting at the bottom of the sea would be rendered non-functional pretty quickly, but the materials would be salvageable. 435