Yes it can. Mattresses affect your sleep quality the most. It has to be comfortable and suit your body type and sleeping position. here some of the best mattresses you could choose from. Your sleeping quality depends on your comfort while asleep. Not getting enough goof quality sleep is one of the main factors of having a headache.