Yes some high quality high end mattresses can easily last 20 years if taken care of properly and you can and should also use a mattress protector on the mattress to make it last 20 years without getting any stains or body fluids on the mattress.
With a mattress protector any spills or stains will stay on the mattress protector and not soak through the mattress which will make the mattress last longer.
Cheaper mattresses though will usually wear down and be ready for the garbage within 8 to 10 years.