Yes a mattress can really impact your sleep.
If the mattress is not comfortable enough for you or the mattress is getting old and not as comfortable anymore then your sleep can be disrupted.
A comfortable mattress is very important to quality sleep and so if your mattress is not very comfortable and you're suffering from Insomnia and cannot sleep then trying a new mattress should help you sleep better.
Make sure you get a comfortable mattress and it's best to go to mattress stores and actually try out some mattresses to see how comfortable they are for you.
A sleep number bed and mattress can also help with sleep as you can dial in your comfort zone on the mattress.
That is also good if you have a partner in bed with you who needs a firmer or less firmer mattress.
I get a new mattress every 8 to 10 years and when I do I find my quality of sleep really does improve.