You can use a bicycle trainer on carpet, but there are a few things to consider. A carpet and the padding underneath can stabilize your bike better than tile or concrete, as the trainer’s feet can sink into the material.
Therein lies the main problem to consider when riding on carpet — the combination of bike, trainer, and cyclist adds up to a significant amount of weight. Over a long enough amount of time, your trainer can leave permanent dents in the carpet.
Also, you’re going to sweat a lot when you work out. Eventually, enough sweat will leave stains on a carpet. This can leave unsightly discoloration if you decide to move your trainer.
A good, sturdy mat under the trainer and bike will spread out the weight and minimize permanent dents. It’s also much easier to clean sweat off a mat than out of a carpet.