The Flames signed the Calgary native to a one-year contract worth $1.25 million. He was due to become a restricted free agent.
Flames general manager Jay Feaster says he wanted Galiardi for his size and versatility.
"He can play left-wing or centre, he competes hard, is a very good energy player and he is only 25 years old," Feaster said in a statement Tuesday.
The six-foot-two, 190-pound forward has compiled 39 goals and 48 assists in 221 career NHL games for the Colorado Avalanche and Sharks.
The Avs drafted Galiardi in the second round, 55th overall, in 2007. His best NHL season to date was in 2009-10 when he had 15 goals and 24 assists in 70 games for Colorado.
Colorado traded Galiardi and forward Daniel Winnik to San Jose for Jamie McGinn, two minor-league players and a draft pick at the 2012 trade deadline.
Galiardi scored six goals and had nine assists in 50 regular-season games for the Sharks. He had a goal and an assist in 11 playoff games for San Jose this past season.
Galiardi averaged almost a point per game for the Western Hockey League's Calgary Hitmen in 2007-08. He led the WHL in post-season scoring with five goals and 19 assists in 16 games.