Doctor Eggman Nega's Camera is the primary plot driver in Sonic Rivals, the only game in which it features. Brought from the future by Eggman Nega, the device provides an in-story rationale for the collectable cards that are picked up over the course of the adventure. The camera, rather than simply taking a photographic image of its subject, actually converts whatever it's used on into a two-dimensional card.
Sonic Rivals never clearly states whether Eggman Nega created the camera himself or stole it from elsewhere. Either way, the device comes from the same time period / alternate dimension as Nega and Silver the Hedgehog inhabit. Silver's whole reason for pursuing Nega into the past is to prevent him from using the camera's power to wreak havoc. The fantastic photographic device first makes its power felt in Sonic's time before Rivals' story actually begins. Knuckles the Echidna, guarding the Master Emerald just like he's supposed to, sees the great gem simply pop out of existence before his very eyes. Unknowably to the Guardian, Eggman Nega photographed (is going to photograph?) the jewel centuries later, on Onyx Island; but because of the Master Emerald's transcendental properties, the effect propagates backwards in time to abstract the Emerald from Angel Island too.
After Nega (and Silver) come to the past themselves, the mad doctor uses his camera to card-ise his own counterpart/ancestor, Dr. Robotnik, as well as Tails, Amy, Rouge, and (depending on how literally you interpret the game's card-collection gimmik) a host of other characters and items. After suffering multiple defeats at the hands of Sonic, Knuckles, Shadow, and Silver, Nega decides (in an act of blatant crazy) to turn the planet itself into a card. Mounting the camera in his spaceship, the Egg Destroyer, and supercharging the device by connecting it to the Master Emerald card (as well as those of Rouge and Amy), Nega blasts off to execute his omnicidal plan. The heroes eventually disable the ship, causing Nega to lose control of the camera and get turned into a card himself.
How Nega (or anyone else) escapes from their cards is not explained; but given that Tails, Amy, and the other two-dimensionalised characters were apparently recovered simply by Sonic and friends acquiring their cards, returning to 3D doesn't seem that hard.