Born in Ann Arbor, Michigan, and raised in Farmington Hills, Michigan, Petry spent three years playing varsity hockey at St. Mary's Preparatory, in nearby Orchard Lake Village. He left prior to his senior season in November 2005 to play for the Des Moines Buccaneers of the United States Hockey League (USHL), a member of the team's 2006 Tier 1 National Championship-winning team.
Petry was then drafted by the Edmonton Oilers of the NHL in the second round of the 2006 NHL Entry Draft, 45th overall. He was the Oilers' highest draft pick that year, as the Oilers had previously traded their first-round pick to the Minnesota Wild in exchange for goaltender Dwayne Roloson. Petry would play the following season with the Buccaneers, once again helping the team reach the playoffs.
In 2007, Petry accepted a scholarship with Michigan State University. He registered 24 points (three goals and 21 assists) and was named to the Central Collegiate Hockey Association (CCHA) All-Rookie Team in his freshman year. The following season for Petry saw a drop in performance, as he was held to a total of 14 points (two goals and 12 assists). He achieved a significant improvement to his game for his junior year at Michigan State, however, as he finished third overall in team scoring and first as a defenseman, collecting 29 points (four goals and 25 assists).
Petry was ever-present for his team, playing in all the Spartans' games for the three seasons he was there.
Upon completing what would be his final year at collegiate level, Petry signed a two-year, entry-level contract with the Edmonton Oilers on March 10, 2010. He was then briefly assigned to the Oilers' then-American Hockey League (AHL) affiliate, the Springfield Falcons, playing in eight games. He played his first game as a professional on March 26.
On September 30, 2010, Petry was assigned by the Oilers to their new AHL affiliate, the Oklahoma City Barons, for its inaugural season. On December 27, Edmonton recalled Petry from Oklahoma City. He then made his NHL debut against the Buffalo Sabres on December 28, 2010, and recorded his first NHL point, a secondary assist on a goal by Ryan Jones. His first NHL goal was scored on January 20, 2011, against Kari Lehtonen of the Dallas Stars. On February 4, 2011, Petry was reassigned back to the Barons.
Petry improved in his second NHL season, leading all Oilers defensemen in points, with 25, and was trusted into a shutdown role alongside Ladislav Šmíd. At the end of the 2011–12 season, on June 7, 2012, Petry re-signed on a two-year, $3.4 million contract with the Oilers.
At the start of the 2011–12 season, Petry made Edmonton's NHL roster out of training camp and subsequently played three regular season games before being assigned to Oklahoma City. After only two games in the AHL, however, Petry was recalled back to Edmonton, where he remained for the entire season, playing in 73 games.
After the Oilers missed the playoffs in 2012, Petry was invited to play for Team USA at the 2012 IIHF World Championship. He amassed six points in nine games, though the United States were eliminated in the quarter-finals by Finland. Petry stayed as a permanent member of the Oilers for the lockout-shortened 2012–13 season, playing in all 48 games as the Oilers again failed to make the Stanley Cup playoffs that year.
On March 2, 2015, during the 2014–15 season, Petry was traded to the Montreal Canadiens in exchange for a 2015 second-round draft pick and conditional fifth-round pick. After the Canadiens post-season run, on June 2, 2015, Petry opted to surrender his impending free agent status in signing a six-year contract extension with the Montreal Canadiens until the 2020–21 season.
Petry is a second-generation professional athlete. His father, Dan Petry, is a former Major League Baseball (MLB) pitcher who earned a World Series ring as a member of the Detroit Tigers in 1984. Petry has an older brother, Matt.