Why is that? The reasons vary. Advancements in medicine. A focus on nutrition. Year-round training. The dangling carrot of multimillion dollar contracts has made long-term fitness more profitable than ever for high-caliber athletes. All of that has combined to make 40 the new 30 in baseball.
I honestly believe some people (Glaiven, Smoltz, Johnson) just love the game too much to give up. Plus, the fact that people are living longer, muscles are holding up better, tommy john surgery helps, as does the fact these pitchers pitch to their gameplan. And know how to keep their arms going fine.
Outside of that you have guys like Bonds, who having a place in the hall of fame will make you do amazing things...legal or not.