These pistols can run for quite a while without cleaning.
But there are several really good reasons to clean and lube a pistol regularly.
One is so that it functions reliably in the short term. Power residue on the rails can slow down the slide and cause the pistol to FTF, FTE, etc. Residue in the extractor can cause that part to jump the rim and you get a FTE. As mentioned above, powder residue in the chamber can cause cases to fail to load or fail to extract.
Powder buildup, and especially copper or lead buildup in the leade area and the lands/grooves of the barrel, will eventually constrict the path of the bullet. This affects accuracy and, if it gets bad enough, will cause the bullet to slow down and chamber pressures to rise. If pressures go too high, first primers will be seen to flatten, then if pressures go up more they will blow out, and in the worst instances the case itself can burst. Damage to the pistol or people nearby can result. It is even possible a bullet will get stuck half-way down a barrel that has significant copper or lead buildup, and the next round down the pipe behind it can cause the barrel to explode.
Another reason is related to a kind of pollution. Primers contain lead styphnate, and everywhere there is powder residue, there is vaporized lead (in small quantities). If the bullets have exposed lead at the base, they can leave more vaporized lead particles on the internal and external parts of the pistol. This lead is poisonous to humans, and you don't want it on your hands, from which it can be transferred to your mouth or nose and ingested. When the pistol is dirty, there is just more of this stuff on your hands and clothing (shooters with small children in the house should pay particular attention to this; always clean guns in isolated areas -- never on the kitchen table! And you should always wash your face and hands after shooting or cleaning a gun).
Finally, there is wear from the parts working together with the powder grit between them. The slide rails, the outside of the barrel at the front of the slide, etc., will all wear faster if the pistol is not cleaned and lubed regularly. The powder residue works like the sand on sandpaper. And the chemicals in powder residue can cause the metal itself, and the finishes, to slowly corrode.
So, altogether, there are lots of good reasons to clean and lube a pistol shortly after using it. There are cases of shooters not cleaning their pistols for long periods of time, and it is a sort of testimonial to the toughness of that particular gun, but it is generally not a good thing to do.
(Sorry for the "tutorial" but we sometimes see new shooters on this forum and they might not have been told all of this).