In a nutshell – we don’t really know.
It’s said that nothing last forever. Everything eventually wears out. The same is true of vaccines. However, by that time the body (should have) built up its own antibodies against the diseases. Unfortunately, everyone’s different. No two bodies are alike. That’s why it’s so hard to find a cure for cancer. Everyone’s DNA is different. As such, the way we react to a disease is different (as we’re seeing now with COVID). Thus for some (many) a vaccine may last a lifetime, while with others (a few) it doesn’t.