How good was a 40 years old or 50 years old frontline warrior expected to be historically? Experienced or decrepit?
I know boxing champion statistics, but war is more complicated than boxing.
The Romans were known to retire their soldiers with a pension after 25 years of service. That would probably have put most of them in their early to mid 40's.
Given that experienced veterans are generally far better soldiers than new recruits, I think its fair to say they wouldn't have done that if they could typically expect another decade of good performance (from the early 40's to the early 50's).
Probably mostly identical.
Historically, a typical "fighter" would be much less the kind of fighter like in the romantic Ivanhoe / Lancelot / Robin Hood movies from the 1960s, nor an elite one-man-army as depicted in a more recent movie.
In antique times, a fighter would typically be someone carrying a spear and a shield, walking in a phalanx or similar formation. It might be a slinger or archer. With few exceptions (Romans and Spartans), soldiers were not professionals, but more or less ordinary citizens or peasants.
In not-so-antique times, a fighter would typically be a peasant carrying a pike or a flail (quite possibly a real flail, not a military one), or quite possibly an archer. In what is nowadays southern Spain, he might still be a slinger rather than an archer.
For the most part, a 50 year old can drive a spear into another person, walk in a phalanx, or pull a bow just as well as a 20 year old could. Of course, being in a phalanx as such significantly reduces the likelihood of reaching the age of 50 in the first place (for obvious reasons).
They might arguably be less apt for the super-hefty work such as operating a trebuchet or climbing up a siege ladder, but there's more to this world than just trebuchets. There is no reason to believe a healthy 40 year old couldn't work as sapper or miner, for example.
As stated in another answer, the Romans were known to retire their soldiers after 25 years. In my opinion, there is however a different and much more compelling reason for doing this than the fact that old soldiers are useless.
How do you rule an empire much larger than you ever thought it would be with hostile tribes at every corner if you do not have nearly enough soldiers? There is only one solution, you need more soldiers, and they need to grow locally.
That, however, sounds easier than it is done. How do you convince someone (who probably hates you for having invaded their home) to fight, and probably die for your goals? Forcefully enrolling an army may work, but it is a mediocre army at best, and turns against you in the worst case (with the weapons that you gave them!).
Those people who will bleed and die for you need a very good motivation for doing so. For someone who has little to eat and basically the social status of a dog, being able to call himself and those who follow in his line a Roman Citizen after serving in the army for 25 years is an excellent motivation.
If, on the other hand, you had to serve until you succumb to old age, then why would you want to do it?
Having started to read through the Canterbury Tales again this afternoon, I remarked, and wish to quote the following passage:
A knyght ther was, and that a worthy man
[lengthy list of fights and feats]
For he was late ycome from his viage,
and wente for to doon his pilgrymage.
With hym ther was his sone, a young squier
of twenty yeer of age he was, I gesse.
What we read there is that a formidable knight just came home from his latest campaign together with his son, a young squire of 20 years.
Not only do we learn that at the age of 20 you're actually being considered young for a squire, but also the narrative places Chaucer's Knight at around the age of 40, which quite obviously isn't considered in any way too old to go on a campaign.
A bit roundabout - but warriors who get old are the ones most likely to survive, either in positions of safety to being with, or lucky IMO.
It would be worth considering average lifespans and wound survivability - a general having an arm amputated would have a much more comfortable life than a foot soldier
From my point of view, it is worth remembering that in an Army, you're guaranteed to get fed, be looked after, compared to being a serf, slave or peasant - an attractive proposition. Also consider that it is expensive to train a soldier, you are not only providing them supplies but weapons, armour and training.
You will spend time relative to how important that solider is. Cavalry (google wikipedia cavalry and in the social status section), for example, are pooled from people who are "important", and that given being used (in most cases) as a shock force, probably gave them a lot more survivability than your average frontline trooper. The troops who survive are also more valuable to you (you end up promoting them) for training and leadership purposes, so you keep them safer.
This is an interesting question, and I'd be interested to know about more medieval times, but the obvious one to me was the European wars and the usage of cannon, and in particular, the Battle of Waterloo.
There is a good description of how injured soldiers went in the aftermath (badly) http://blog.wellcomelibrary.org/2015/06/wounds-from-the-battle-of-waterloo/
But also, luckily enough, Wikipedia has a breakdown of the order of battle. Sadly in most cases we only get a count of the officers killed. In the Waterloo article itself, the French forces, 68% infantry, 19% cavalry, took 56% total losses. The Anglo-allies, taking 20% causalities.
Those promoted to officer status, looking at the French I corps (19,357 men), infantry (17,615 men) with an attached light cavalry unit (1,738 men). Infantry lost ~46% of officers, Cavalry lost ~35% of officers. Given officers proportionately are much smaller than soldiers, and taking the overall losses into account it could be argued that the officers got through better (given these losses were on the losing side)
I think it stands to reason with T.E.D and Damon's answers above that the survivors get old by avoiding being in the frontlines. For example, if you got a stomach wound before modern surgery you were very likely to die from Peritonitis