It's a homecoming for Panik, who attended high school in Hopewell Junction, New York, and attended St. John's University. He cleared waivers on Friday.
"I was ecstatic, because you never know in these types of situations what's going to happen. It couldn't have worked out any better for myself personally," Panik said. "I have a lot of family and friends in the area. For me to be coming to a club that's hot in a playoff push is very exciting. For me, it's a great situation."
The Mets, who enter Friday's game against the Washington Nationals just a half-game out of the second National League wild-card spot, need a second baseman after Robinson Cano tore his left hamstring earlier this week. Panik is playing second base and batting eighth in Friday's contest.
Panik hit .235 with three homers and 27 RBIs in 103 games for the Giants this season. In 643 career games with San Francisco, he hit .271 with 36 homers and 221 RBIs.
In a corresponding move, the Mets designated infielder Adeiny Hechavarria for assignment. Hechavarria had hit .204 with five home runs and 18 RBIs in 60 games this season.
Cano, 36, is hitting .252 with 10 homers and 32 RBIs in his first season with the Mets after being acquired from Seattle. Infielder Luis Guillorme, who was called up from Triple-A Syracuse when Cano was placed on the injured list Monday, has been starting at second base this week.
A rookie in 2014, Panik played a large role that postseason as the Giants beat the Kansas City Royals for their third World Series championship in five seasons. In Game 7, Panik started a key double play when he dived to snare an Eric Hosmer grounder, then flipped the ball with his glove to shortstop Brandon Crawford, who threw to first.