The main reason why cats scratch is because they mark their territory. This is purely instinct and they do this by adding visible scratch marks around the house (if they're not fond of the scratching post) and at the same time spread their scent through their paws.

When the cat scratches, it makes her stretch and pull towards her, giving her good exercise. Scratching also removes the dead outer layer of their nails.