There are still questions about how troops will accept it and whether it will affect the U.S. military effort in Afghanistan and Iraq.
The bill requires the president and top military advisors to certify that lifting the ban won't hurt troops' ability to fight. After that, the military will undergo a 60-day wait period.
The issue of gays in the military has been a contentious one for decades. Until 1993, all recruits had to state on a questionnaire whether they were homosexual; if they said "yes," they could not join.
More than 13,500 service members have been dismissed under the 1993 law.
In the years since the ban went into effect, views in the wider society have evolved. Surveys show that most Americans think it's OK for gay men and women to serve in the military.
The repeal vote by Congress was a political victory for Obama, who campaigned on ending the ban.
The Associated Press contributed to this report.