Museveni said last month he wouldn't sign the bill but then backtracked because he said Ugandan scientists determined there's no gene for homosexuality and it was abnormal behavior, CNN reported.
"It was learned and could be unlearned," Museveni said.
While Museveni was mulling whether to sign the bill into law, U.S. President Barack Obama warned that enacting the bill would affect U.S.-Uganda relations, describing the legislation as an "affront and a danger to the gay community" in Uganda.
The White House released a statement Monday calling the law "a step backward," adding the United States will continue to advocate for "protection of the universal human rights of LGBT persons in Uganda and around the world."
Nigerian President Goodluck Jonathan several weeks ago signed an anti-gay bill into law in which offenders could be sentenced to as long as 14 years in prison, the New York Times reported. Jonathan's decision led to violence against gays across the country.
Uganda's Parliament passed the bill in December, replacing a death penalty provision with a language that called for life in prison for "aggravated homosexuality," which includes acts in which a person is infected with HIV, "serial offenders" and sex with minors, Amnesty International said.
Among other things, the bill proposed years in prison for those counseling or reaching out to gays and lesbians, a provision that would affect rights groups and others offering services to the LGBT community.
Amnesty International said homosexuality is illegal in 38 of 54 African countries.