The Same Sex Marriage Prohibition Act also criminalizes homosexual clubs, associations and organizations, with penalties of up to 14 years in jail.
The act has drawn international condemnation.
"We call on Nigeria to repeal this law and to promote and protect the human rights and fundamental freedoms of all Nigerians regardless of their sexual orientation," Baird said Monday in a release.
"Canada has clearly spoken out against human rights violations committed against people on the basis of their sexuality, and we will continue to do so."
Some Nigerian gays already have fled the country because of intolerance of their sexual persuasion, and more are considering leaving, if the new law is enforced, human rights activist Olumide Makanjuola said recently.
Nigeria's law is not as draconian as a Ugandan bill passed by parliament last month which would punish "aggravated" homosexual acts with life in prison. It awaits the president's signature.
But Nigeria's law reflects a highly religious and conservative society that considers homosexuality a deviation. Nigeria is one of 38 African countries — about 70 per cent of the continent — that have laws persecuting gay people, according to Amnesty International.
The Associated Press on Monday obtained a copy of the Same Sex Marriage Prohibition Act, which was signed by President Goodluck Jonathan and dated Jan. 7.
It was unclear why the law's passage has been shrouded in secrecy. The copy obtained from the House of Representatives in Abuja, the Nigerian capital, showed it was signed by lawmakers and senators unanimously on Dec. 17, though no announcement was made.
U.S. Secretary of State John Kerry said Monday the United States is "deeply concerned" by a law that "dangerously restricts freedom of assembly, association, and expression for all Nigerians."
Britain said, "The U.K. opposes any form of discrimination on the grounds of sexual orientation."
A statement from the spokesman for the British High Commission, traditionally not identified by name, said the law "infringes upon fundamental rights of expression and association which are guaranteed by the Nigerian Constitution and by international agreements to which Nigeria is a party."
The British government last year threatened to cut aid to African countries that violate the rights of gay and lesbian citizens. However, British aid remains quite small in oil-rich Nigeria, one of the top crude suppliers to the U.S.
Washington-based Human Rights First urged President Barack Obama to "consider all avenues for response," saying leaders such as Uganda's president, Yoweri Museveni, will be watching.
"This law threatens the very livelihood of LGBT people and allies in Nigeria, and sets a dangerous precedent for persecution and violence against minorities throughout the region," said the organization's Shawn Gaylord.
The motivation for the Nigerian law is unclear, given that the country already has one making homosexual sex illegal. And gay people were not demanding to be married in a country where being gay can get a person lynched by a mob. In parts of northern Nigeria where Islamic Shariah law is enforced, gays and lesbians can be legally stoned to death.
Some have suggested the new law in Nigeria and the proposed one in Uganda are a backlash to Western pressure to decriminalize homosexuality. Several African leaders have warned they will not be dictated to on a subject that is anathema to their culture and religion.
Yahya Jammeh, the president of Gambia, has said homosexuals should be decapitated.
In June, Senegal's president, Macky Sall, argued with Obama about the subject at a news conference. Sall told the AP afterward that other countries should refrain from imposing their values beyond their borders.
"We don't ask the Europeans to be polygamists," Sall said. "We like polygamy in our country, but we can't impose it in yours. Because the people won't understand it. They won't accept it."
Jonathan, Nigeria's president, has not publicly expressed his views on homosexuality. But his spokesman, Reuben Abati, told the AP on Monday night, "This is a law that is in line with the people's cultural and religious inclination. So it is a law that is a reflection of the beliefs and orientation of Nigerian people. ... Nigerians are pleased with it." Abati said he has heard of no Nigerian demonstrations against the law.
The few Nigerian gays and human rights activists who tried to give evidence last year during the debate in the House of Assembly were heckled and booed until one broke into tears and another could not be heard.
Nigerians are the least tolerant nation when it comes to gays, with 98 per cent surveyed saying society should not accept homosexuality, according to a study of 39 nations around the world by the U.S. Pew Research Center.
Under Nigeria's new law, it is now a crime to have a meeting of gays, to operate or go to a gay club, society or organization, or make any public show of affection.
In a recent interview, Makanjuola, the executive director of the Initiative For Equality in Nigeria, had said: "If that bill passes, it will be illegal for us to even be holding this conversation."
The law now says, "A person who registers, operates or participates in gay clubs, societies or organizations, or directly or indirectly makes public show of same-sex amorous relationship in Nigeria commits an offence and is liable on conviction to a term of 10 years."
Anyone convicted of entering into a same-sex marriage contract or civil union faces up to 14 years imprisonment.
Some critics have suggested the anti-gay law was designed to distract attention from Nigeria's many troubles, and to win Jonathan favour with powerful churches that influence voters. His party has fractured ahead of 2015 elections over his expected plan to run for re-election.
Nigeria is enduring an Islamic uprising in the northeast that has killed thousands of people, deadly ethnic-religious clashes in the centre of the country, and renewed militancy in the oil-rich south, where activists are demanding a bigger share of oil wealth, which is now being squandered by widespread corruption.
Makanjuola said those who will suffer most under the new law are poor gay Nigerians. Many rich ones have left the country, or say they will fly elsewhere to have sex, she said.
The court of the European Union recently ruled that laws such as Nigeria's could provide grounds for political asylum.
A statement by the Nigerian Lesbian, Gay, Bisexual, Transsexual and Intersex Diaspora urged lawmakers not to make them refugees.
Criminalizing same-sex relationships "turns us into asylum seekers in other countries," it said. "We visit home with trepidation because at home we have to live a life full of lies and deny who we are for us to be accepted. Why do we want to keep subjecting our citizens to such psychological and emotional torture?"
— with files from The Canadian Press
Also on HuffPost