It depends on the laser (quality and wavelength) whether it will work or not. Not all can. "Blue" lasers tend to be marketed as "track anywhere" devices but I note they are not all equal. My Logitech Nano blue laser I use with my notebook tracks very well on carpet, the arm of my chair or even my jeans. But it does not like shiny table or desk tops. My MS 5000 blue laser tracks great on any desktop, but not so well on other things.
The best case scenario is simply keeping the laser access port (hole) clean - and a handy can of compressed dusting gas works great for that.
However, red flags went up when I read your post. You said "touchpad" so that suggests you are using a notebook. My first concern is heat - I hope you are NOT setting your notebook directly on the carpet (or your lap, or bed, etc.). Notebooks need clearance underneath for cooling. So notebooks should always be operated on a hard, flat, smooth surface, like a
Notebook Cooling Pad w/ext. power supply.
Also, carpets are notorious for generating HUGE potentials of static electricity in our bodies. Shuffle across the carpet and touch the dog's nose can cause your arm to recoil and the dog go running. Unfortunately, static potentials can be so tiny their discharges are below the threshold of human awareness yet be plenty high to destroy ESD (electro-static discharge) sensitive devices - like memory modules, CPUs, GPUs - essentially any IC.
So my advice, sit on a wooden chair at a wooden table.