There are a number of ways to temporarily remedy a hairball problem -- some more advisable than others -- but if a cat is suffering with frequent hairballs it's important to rule out serious underlying conditions as a possible cause for the digestive disturbance.
This is especially true if the hairballs are a new problem in a mature cat. Sudden GI issues in a middle-aged or senior kitty should always be thoroughly investigated.