The carpet is more likely to accumulate excess electric charge (static electricity) over time when there is no good way for it discharge. The dry air, as was said, insulates the carpet and makes it prone to such accumulation. This is less the case with humid air that allows the carpet to continuously discharge a portion of its electric charge over time and thus spares us--the walkers--a minor shock.