The law, known as DOMA, was passed in 1996 amid a furor over same-sex marriage. Since then, eight states — starting with Massachusetts in 2004 — have permitted gay marriage while scores of others have banned it.