The 32-year-old spent the last five years as under-study to Germany goalkeeper Manuel Neuer, winning five German league titles and three German Cup final wins in Munich.
He was part of the squad which won the Champions League in August and has been signed by Hamburg to replace Julian Pollersbeck, who has joined Lyon.
Ulreich has made 70 appearances for Bayern and started 29 Bundesliga games in 2017/18, as well as 11 in the Champions League that season when Neuer was injured.
However, he faces competition to under-study Neuer, 34, since Bayern signed Alexander Nuebel, 24, joined from Schalke.
"Sven is a great team player, when Manuel Neuer injured himself in 2017, Sven stepped in really well," said Bayern sports director Hasan Salihamidzic.
"Hamburg are getting an internationally experienced goalkeeper who can take on a leadership role."
ryj/iwd