Among the many things that might have been more common in the past but weren’t a wise design choice, carpeted bathrooms are probably one of the worst. There are many reasons why having carpet in your bathroom is a bad idea. For example, when you have a lot of moisture in the air, water dripping from persons coming out of the shower, and other sources of moisture, you are bound to have water seep into your carpet. This can lead to mold growth that goes unnoticed for a long time.
Another problem is that of hygiene. If you have messy people using the toilet, there is no easy way to clean up your carpet, while a tiled floor can be cleaned well with a disinfectant.
If you are currently stuck with a carpeted bathroom, you should make sure that you have the means to do a deep cleaning, preferably using a good carpet cleaner that can really dig in there.