It was caused in part by deregulation (less rules for banks), and in part by regulations that existed (pressure on banks to do subprime loans).
This fallacy has been debunked so many * times, it's getting tiresome. The only pressure applied to banks was pressure from their own greed. They wanted in on the MBS action, so they created their own CDOs from loans originated by non-banks like Countrywide. As entities like Countrywide are not regulated as banks, they weren't compelled by any law to originate loans from low-income homeowners, if that's this "pressure" that you're referring to. In fact, these loans were way more risky than the FHA loans that the GSEs originated and securitized,
However, around the time the * hit the fan, the GSEs did start lowering their origination standards--not because of some government mandate, but because they wanted to regain market share of the MBS market that they lost to the investment banks creating CDOs from portfolios of subprime loans. Again, greed is solely responsible. You have to remember that GSEs are NOT some sort of government agencies. They are true private sector companies that were traded on the NYSE.