|The following information is from the Adventure Time comic book series. It may not be part of the same canon or continuity as the animated series.|
Carl the Gem is a gemstone with the ability to shoot lasers. He landed on Earth in a meteor shower and landed in a volcano, where he sunk into the mantle and the heat and pressure formed him into a gemstone. He was supposed to land with his friend Gemma, but she landed in another volcano.
65 million years later, Bonnibel Bubblegum retrieved both Carl and Gemma to make them into friendship amulets, giving Carl to Marceline and Bonnibel uses Gemma to help build the Candy Kingdom. Marceline puts Carl in a box but he isn't taken out again until a couple hundred years later when Marceline and the newly dubbed "Princess Bubblegum's" relationship was straining.
In present day, Finn and Jake find Carl in a treasure chest Marceline left in the attic of the Tree Fort. Ricardio then bursts in to steal Carl after stealing Gemma in a plot to make Princess Bubblegum like him. He uses Gemma to bring the robotic Tree Fort to life to beat up Finn and Jake up, but Marceline and Princess Bubblegum come and defeat Ricardio and reprograms Robohouse. Carl and Gemma are finally reunited when the four heroes decide to put them back in the treasure chest put it in a dungeon for heroes. They returned from time to time throughout their lives to add more treasure.
In the far future, both Carl and Gemma fell under the ownership of a young adventurer who made it through the dungeon to claim the treasure.