Both men came on as second-half substitutes in a match Sunday intended to highlight the work of the International Criminal Court. Museveni's "Dignity" team beat Ban's "Justice" team 1-0 at Mandela Stadium in Kampala, Uganda.
Museveni and Ban played for about 10 minutes, with Museveni being taken down in the penalty area when clear on goal. Despite his appeals, the Ugandan leader was denied a penalty.
The smiling Museveni was then helped up by Ban.
About 2,000 war victims from across Africa were attending the game.