Under the proposed legislation, those convicted of homosexual acts could face life imprisonment.
The law would also make it a crime not to report gay people.
Promotion of homosexuality – even talking about it without condemning it – would also be punishable by a prison sentence.
The private member’s bill originally proposed the death penalty for some offences, such as if a minor was involved or the perpetrator was HIV-positive, but that clause has been dropped.
Uganda already has legislation banning gay sex between men, but the proposed law sharply tightens restrictions – and covers lesbians for the first time.
The US is one of Uganda’s largest foreign aid donors, and in 2011 a small number of American troops were sent to help the Ugandan military fight the rebel Lord’s Resistance Army.
But President Obama, who once referred to the proposed law as “odious”, says this relationship will become more complicated if it is approved, describing it as an affront, and a danger to, Uganda’s gay community.
America’s National Security Adviser, Susan Rice, said on Twitter that she spoke at length with the Ugandan President Museveni on Saturday night to urge him not to sign the bill.
President Obama’s statement didn’t limit criticism to Uganda, noting an increase in reports of violence and harassment of homosexuals from Russia to Nigeria.
A month ago, President Museveni refused to approve the controversial bill.
His spokesman said that the president believed that gay people are sick but that he did not believe they should be killed, or jailed for life.
“What the president has being saying is that we shall not persecute these homosexuals and lesbians. That is the point,” said Tamale Mirudi.
Mr Museveni has been trying to reach a compromise with MPs, because if he refuses to sign the bill, parliament can still force it through with a two-thirds vote.
In a letter written to the parliamentary speaker when he blocked the bill in January, he disputed the view that homosexuality was an “alternative sexual orientation,” reasoning that “You cannot call an abnormality an alternative orientation. It could be that the Western societies, on account of random breeding, have generated many abnormal people.”