But earlier this week, Utah Gov. Gary Herbert's office said Utah would not recognize those marriages after Shelby's ruling was put on hold by the U.S. Supreme Court pending an appeal.
Gansler, a two-term Democrat running for governor, was the first high-profile state official to back same-sex marriage in Maryland, and in 2010 issued a legal opinion that Maryland was obligated to recognize same-sex unions performed in states where they are legal.
Gansler used that opinion as the basis for his announcement Friday, which came in response to a letter from the Human Rights Campaign, the country's largest lesbian, gay, bisexual and transgender rights organization.
The group urged the federal government and the 17 states and Washington where same-sex marriage is legal to recognize the Utah marriages that had been performed. Maryland approved same-sex marriage in 2012.
The Obama administration also issued a statement Friday saying the federal government will honor same-sex marriages in Utah.
"These marriages will be recognized as lawful and considered eligible for all relevant federal benefits on the same terms as other same-sex marriages," U.S. Attorney General Eric Holder said in a statement.
"These families should not be asked to endure uncertainty regarding their status as the litigation unfolds," Holder said.
In a letter to HRC's Griffin, Gansler said Maryland would recognize Utah's same-sex marriages as it moves toward "fulfilling the Constitution's promise of equal protection under the law."
In an interview, Gansler said that many states where same-sex marriage is legal have not settled whether they will recognize unions from elsewhere. "Many states don't have that opinion because they weren't ever asked about it," he said.