It's a combination of factors, and a big dose of good luck. Not having had catastrophic type injuries, especially to your knees and hips, goes a long way.
Because you aren't cutting at speed or running/jumping nearly as much as any other position, you don't get the no-contact injuries very often. What really gets guys in a bad spot for their career is when someone rolls up on the back or side of the legs. That kills careers. But also, if you are the hammer far more often than the nail, you will play longer. By playing on more great teams, especially ones that run the ball, instead of constantly absorbing hits, you are the one dealing them out. And you are far more often playing exhausted DLS late in games.
If you are a road-grading type, you are also able to play longer, even when you lose a step and can't dominate pass reps anymore. It doesn't hurt that, in football in general, the OL prototype has changed to a far more sustainable model, and the gap between replacement level and all-star is so vast. You can backslide a very long way without playing your way out of the league.
Ol also has some of the best resources for off-season training. The level of trainers available and the camp out there is extraordinary. It's only beaten by QBs, and has passed DL imo. Teams and trainers at every level are so used to taking big kids with upside and a severe lack of polish, and trying to turn them into useful players, that not much scares people off linemen. Most young guys would prefer to play DL over OL as well. So the kids who want it will always find their way to help. But it also means that older guys who have been hurt, like Yoshi, have an endless string of resources and chances to fix what's wrong and get themselves where they need to be.
This is a big part of why the CFL focuses the ratio on the OL, and why it is the cornerstone of every team's ratio. the fact.
The normalization and modernization of Ol builds have made a huge impact on longevity. We don't see guys having to constantly go up in weight for TC, or see teams pushing guys to be bigger and bigger. Guys 6'3 walking around at 295-305 with an athletic build are just a whole lot healthier than the old standard of 325+ lbs guys on squat frames. The growth of the importance of wingspan is wild, but those long guys often have a much better frame to carry weight.