Gov. Martin O'Malley, a Democrat, signed the bill Thursday, a week after its final passage in the Legislature. The law is scheduled to take effect in January 2013.
However, opponents are expected to petition the law to a referendum on the November ballot.
Referendum organizers need to collect almost 56,000 signatures to put the measure before voters and are expected to rely heavily on churchgoers who oppose same-sex marriage as a matter of faith, to reach that goal.
Some pastors in predominantly black churches have begun using their sermons to push the referendum.