Yes, a bad mattress can have adverse effects on your immune system. Poor sleep quality caused by an uncomfortable mattress can weaken your immune system, making you more susceptible to illnesses and infections. Therefore, it is important to choose a mattress that provides proper support and comfort for a good night's sleep and overall health.