On February 23, 2017, Hainsey, in the final year of his contract, was traded to the Pittsburgh Penguins in exchange for a second-round pick in the 2017 NHL Entry Draft and Danny Kristo. It was the first time that he had been traded in his career. It was with the Penguins that on April 12, 2017, after 907 career NHL games and surpassing Olli Jokinen's previous playoff games drought "record", Hainsey made his Stanley Cup playoff debut, doing so against the Columbus Blue Jackets. Hainsey and the Penguins went on to win the Stanley Cup over the Nashville Predators in the Finals.