Where was the 45th infantry division from in the war of 1812?

The Infantry Division did not exist in 1812. Instead there was a 45th regiment, mainly from Massachusetts and what would become Maine.

From the District of Maine in Massachusetts. Maine became a separate state in 1820.