The short answer is likely not properly maintaining the transmission. The Subarus run hot and breakdown the transmission oil. If they're not properly maintained the transmission can start to have problems quickly. The car probably will tell you what the problem is if you run through the self diagnostic system. This will trigger the car to blink a code on the dashboard which will narrow down the problem. There may be a cylinoid in the transfer case that has gone bad that moves the car into and out of four wheel drive. If one of the cylinoids goes bad, it can cause the vehicle to stay in four wheel drive when you don't want it or not go in four wheel drive when you need it. Your best bet is to take it to a transmission specialist, as opposed to a typical auto mechanic.
The 2010 Subaru Legacy has all wheel drive.
The 2008 Subaru Legacy has all wheel drive.
The 2013 Subaru Legacy has all wheel drive.
The 2014 Subaru Legacy has all wheel drive.
The 2002 Subaru Legacy has all wheel drive.
The 2009 Subaru Legacy has all wheel drive.
The 2001 Subaru Legacy has all wheel drive.
The 2003 Subaru Legacy has all wheel drive.
The 2012 Subaru Legacy has all wheel drive.
The 2011 Subaru Legacy has all wheel drive.
The 2007 Subaru Legacy has all wheel drive.
The 2005 Subaru Legacy has all wheel drive.