Mattress manufactures recommend mattress replacement at least every 10 years which is a pretty good time frame and age for a mattress to be replaced but it depends on if the mattress is worn out or has any tear in it when I decide whether I'm gonna replace the mattress with a new one.
Most times you can keep a mattress longer than 10 years if you use a mattress topper or mattress protector on your mattress.
I have a mattress that is 18 years old and still very comfortable but I've used a mattress topper on it and mattress protector to keep it clean and protect it.
If I hadn't been using a mattress topper and mattress protector to protect the mattress then it probably would need replaced at the 10 year mark.