Did you know that having carpet in the bathroom can lead to health problems? Because a bathroom is so high humidity, it can promote mold growth in the carpet that vacuuming won’t prevent. And mold can make you sick.
For the health of your family, you are best to remove the carpet and install something like tile or lino instead. Since both these floorings are solid and do not retain excess moisture, you will not have to worry about mold growth unless a lot of water seeps underneath the flooring and into the sub-floor (plywood) underneath.
And if you love the feel of carpet under your toes when you hop out of the shower or bath, get some bathmats that are specially designed to dry in the bathroom and can also be washed regularly before mold growth ever starts.