There is no law requiring a landlord to clean the carpet. The only possible exception I can think of might be a Section 8 authority. But no.
Now, is it WISE to have the carpets cleaned? Probably. It will make the unit more appealing thus, more marketable.