The Major League Soccer team announced the signing on Friday, noting that the 38-year-old Hartman will also serve as the club's goalkeeping development manager.
Hartman had six shutouts in 30 games with FC Dallas last season. He was not re-signed and has been a free agent.
Luis Robles will continue to be the Red Bulls starting goalkeeper. Hartman will give New York a veteran backup with Ryan Meara still working to get over hip surgery.
Hartman won MLS Cups with the Los Angeles Galaxy in 2002 and '05. He helped Dallas reach the title game in 2010.
New York is 0-1-2 this season.