General manager Doug Wilson announced the move Thursday, saying Hannan will be a good mentor for younger players. The Sharks also signed forwards Michael Haley and Bryan Lerg to one-year deals.
The 35-year-old Hannan played 56 games last season with three goals and nine assists.
Haley has two goals and one assist in 53 career games with the New York Islanders and Rangers. He spent last season in the AHL.
Lerg has played 280 career games in the AHL.