Your vet can check them out too, and see what condition their uterus is in, etc..... and how they are doing. If their uterus is wearing out, or the mare is in poor condition, or becoming a hard keeper, or has other problems, it's time to retire them.
I have known mares that had foals into their 20's with no problems, but knew some that at 18 or 20 were retired. Some just quit cycling. Some just have too much 'wear and tear' in there, some can develope fibrosis that is just due to age, some mare start becoming prone to infections - they are called 'dirty mares' and that can include several reasons why and where they have infections. This can include, but is not limited to, poor vulval conformation, degenerative changes inside, etc...
It really just depends on the individual and what condition they are in... when it doubt, we have the vet out to check them over inside.
We had an old full sized mare that was 25 that we had checked out for breeding. She had never had a foal, and checked out in A one shape- excellent uterus, was still producing eggs.... but we decided not to just because of her age- her teeth were starting to go, and we didnt want to stress her system any more than old age does anyhow. It would have been too hard on her whole being we felt, so we didnt, though her reproductive system was still a go.
I did have a Mini mare that foaled at 25, but had been a broodmare her whole life and had had many.