Law is set to take on the Shakespearean role in 2009 as part of a one-year Donmar Warehouse season at Wyndham's Theatre.
He was last seen on the London stage playing Doctor Faustus at the Young Vic in 2002.
"Doctor Who" hero David Tennant plans to star in a separate Royal Shakespeare Company production of "Hamlet" next year.
Branagh, who directed and starred in the 1996 movie version of "Hamlet," will also act in the 2009 Donmar season in a production of Chekhov's "Ivanov."
Law and Branagh recently collaborated on the remake of the 1972 film, "Sleuth."
The Donmar's residency at the Wyndham's will include a production of Shakespeare's "Twelfth Night," starring Derek Jacobi as Malvolio, the BBC said.
The RSC is staging its own version of the play this year with U.S. actor Jon Lithgow in the role.
Beautician charged with giving client fatal silicone butt injection
Astronomers offer more expansive view of universe