I've figured out that I can use gems to free other prisoners, but what about the balls of yarn? What are they for?
Look for the gift shop in the level select areas. There's a door with two cat guards that you can enter. Once you're in the gift shop, look for a blue portal on your left. This goes to the upper area of the gift shop. There are cats here that you can exchange yarn balls with for props to help you.
From the wiki:
Yarn Balls are items that can be picked up while exploring Story levels. Yarn Balls may either be used to bribe the Cat Guards for Weapon/Tools or traded for other items in the Trading Post.