Generally, a water softener needs to be refilled with salt every 6 months, while carbon water filters need to be replaced every 1-2 years. For a reverse osmosis system, the membrane filter should be replaced once or twice a year.
How long your whole-home water filter or water softener lasts will depend on a variety of factors, most importantly your water usage, local water quality, and, in the case of a water softener, the amount of mineral content present in your water.