New mattresses can give off strong chemical odors. They are treated with stain repellents and antibacterial chemicals, and they contain polyurethane foam. Placing a new mattress outside where it can air out will help dissipate the smells. You can also place a mattress cover of vinyl or tightly woven fabric over the mattress to block odors, according to "Ecoholic," a guide to environmentally friendly products.
If your old mattress smells because of a stain, wet the affected area with water. Sprinkle dry borax onto the wet spot, then rub it into the mattress. Once the spot is dry, you can vacuum up the borax, and the smell should be gone.
Using too much moisture when cleaning your mattress can damage the foam inside, and put you at risk for mold growing within the mattress. Vacuuming your mattress every six months will help remove dust and mold spores, reducing the risk of your mattress smelling musty, according to the book "2,001 Amazing Cleaning Secrets," by Jeff Bredenberg.