To prevent hairballs in cats, you can brush your cat regularly to remove loose fur, provide a balanced diet with hairball control formula food, offer hairball prevention treats or supplements, and encourage your cat to stay hydrated by providing fresh water. Additionally, you can consult with your veterinarian for more personalized recommendations based on your cat's specific needs.