First of all, we must note that there are many conservatives who would argue that government regulation could not have prevented or mitigated this crisis. They would say, instead, that government regulation actually helped to bring about the crisis. That said, there are many people who would say that regulation could have helped. Let us look at a two ways in which it might have done this.
First, the government could have regulated mortgage lenders more strictly. If it had done so, there might have been fewer subprime mortgages. There might, in particular, have been fewer mortgages that were sold through unethical practices to people who could not really afford them. This might have prevented as many people from having their homes foreclosed.
Second, the government could have regulated the trade in derivatives based on these mortgages (derivatives: investment product layering multiple mortgages of varying quality). When housing prices fell, it was not only the people with mortgages who were hurt. Instead, there were many financial institutions that were holding complicated and dangerous mortgage-backed securities. This meant that a crash in housing prices ended up costing them tremendous amounts of money as well. When these financial institutions got into trouble, there was much less money available to lend. If the government had regulated the mortgage-backed securities, there might have been less of an impact on the financial sector when the housing bubble burst.
We cannot know if these sorts of regulations could have helped, but it is plausible that they would have.