The health ministry says there have been 19 deaths and 58 confirmed cases of the often-fatal viral hemorrhagic fever since the outbreak was first reported on September 20.
Authorities say the outbreak is concentrated in the central districts of Mubende and Kassanda and has not reached Kampala, the capital of 1.5 million, despite a husband and wife testing positive there.
In a televised address, Museveni on Saturday ordered Mubende and Kassanda into immediate lockdown, imposing a dusk to dawn curfew, banning travel and closing markets, bars and churches for 21 days.
"I now direct as follows: movements now into and out of Mubende and Kassanda districts are now prohibited," said Museveni, who has ruled Uganda since 1986. "If you are in Mubende and Kassanda districts, stay there for 21 days."
Cargo trucks will still be allowed to enter and leave the two areas, but all other transport — personal or otherwise — was suspended, he said.
Museveni had already ordered traditional healers to stop treating sick people in a bid to halt the spread of Ebola, and ordered police to arrest anyone suspected of having contracted the virus who refused to go into isolation.
Ebola is spread through bodily fluids, with common symptoms being fever, vomiting, bleeding and diarrhea.
Outbreaks are difficult to contain, especially in urban environments.
Uganda's last recorded fatality from a previous Ebola outbreak was in 2019.
The particular strain now circulating in Uganda is known as the Sudan Ebola virus, for which there is currently no vaccine.
The World Health Organization says clinical trials could start within weeks on drugs to combat that strain.