Why do cats' claws retract?
Retraction of claws is a feature of the cat family, Felidae along with some civets that helps them keep those sharp by preventing unwanted wear.These claws are important for the members of cat family, including domestic cats that hunt preys by grasp attack rather than bite.

However cheetah among the big cats that usually hunt through bite-attack, has evolved to have semi-retractable claws that help it generate traction.

In pet cats it has offered another advantage:
Retraction keeps them from getting tangled in fabrics.

Sources: 


Wikipedia
Russell AP, Bryant HN. 2001. Claw retraction and protraction in Carnivora: the cheetah (Acinonyx jubatus)
as an atypical felid. J Zool ,Lond 254:67-76.