Removing the mattress tag from your mattress does void the warrant of the mattress.
You can legally remove the mattress tag from your mattress.
However removing the mattress tag from a mattress you purchased that is still under warranty will and does void the warranty immediately as soon as you remove the mattress tag.
The mattress tags say not to be removed under penalty of law but that is only for the mattress seller and not the consumer.
But if you want to keep your warranty valid for the mattress you must leave the mattress tag on the mattress.
On average, a mattress warranty will last 10 to 20 years.
Some warranty periods are considerably shorter, while other companies offer lifetime mattress warranties that provide coverage for as long as you own the mattress.
Mattress warranties may offer repair, replacement, or refund.
Every mattress comes with a small tag attached to it called a law tag and it typically says, “Do Not Remove This Tag Under The Penalty Of Law.”
Of course, you can remove the tag without legal repercussions, but it's proof of purchase for mattress manufacturers, so removing it voids your warranty immediately.