Depending on your level of DIY/investigation:
The best option is to follow the FSM for diagnosis as specified by Subaru. This will lead you to the correct diagnosis and no wasting of parts.
A: the sensor
B: the wheel bearing
C: damaged wiring (usually due to rodents or a previous wreck/incident).
A 2009 is fairly new to incur any sensor issues but....here are possibilities:
1. clean off the sensor - i've seen them covered in debris, clean them off and they're fine.
2. while attempting cleaning - look at the sensor. I've seen some weathered down significantly.
3. test or replace the sensor
4. wheel bearings - if they're original wheel bearings then it's unlikely the wheel bearing is causing this.
5. wiring damage. any prior accidents? are there rodents around where you live or food in your car, farm, pets, kids, etc? this attracts rodents. i've seen damaged wiring - i think under the passengers side carpeting. you find it by following the FSM procedures for testing the circuits. i was surprised rodents can get under there and chew through stuff under the carpeting, fairly impressive little critters.
Aftermarket wheel bearings can cause ABS lights - but they were more common years ago, I've wondered if the suppliers caught up and address this? And I don't think the light was all that intermittent if i'm reading your description right. But - if they were replaced at some point with aftermarket there are questions.