Steinmeier signed the measure less than a month after the lower house of the German Parliament, which is known as the Bundestag, approved it by a 393-226 vote margin. The bill is expected to take effect as early as Oct. 1.
Lawmakers approved the measure ahead of elections that are scheduled to take place on Sept. 24.
The Social Democratic, Green and Free Democratic Parties all back marriage rights for same-sex couples. Chancellor Angela Merkel voted against the bill, even though she said her position on whether to allow a vote had changed.
Gays and lesbians can legally marry in Finland, Sweden, Norway, Denmark, the Netherlands, Belgium, Luxembourg, France, Spain, Portugal, Gibraltar, Guernsey, England, Wales, Scotland, the Isle of Man, Ireland, the Faroe Islands and Iceland. A bill that extends marriage rights to same-sex couples in Malta received final approval earlier this month.
Germany since 2001 has allowed gays and lesbians to enter into civil partnerships. It is among the last countries in western Europe to extend marriage rights to same-sex couples.