Desharnais, who turns 31 on Sept. 14, had six goals and eight assists in 49 games with the Edmonton Oilers and Montreal Canadiens last season. He was traded to the Oilers on Feb. 28 and had four points in 13 Stanley Cup Playoff games.
The Rangers traded center Derek Stepan to the Arizona Coyotes on June 23, and center Oscar Lindberg was selected by the Vegas Golden Knights in the NHL Expansion Draft on June 21.
"They lose two centers so they only have two centers (Mika Zibanejad and Kevin Hayes), so that's a good opportunity for me to come and have a little bit of ice time and show what I can do," Desharnais told the Rangers website. "I feel like it was a good fit."
He signed with the Canadiens as an undrafted free agent on Nov. 5, 2008. He has 254 points (81 goals, 173 assists) in 453 regular-season games with the Canadiens and Oilers, and 17 points (four goals, 13 assists) in 51 NHL playoff games.