Gems are a currency introduced on Steam on December 12, 2014, during the Holiday Sale 2014 event. Gems can be obtained by "recycling" trading cards, emoticons, and profile backgrounds that you own. Doing so destroys the card, emoticon or background, and gives a certain number of gems depending on the item.
Item rarity does not seem to matter with regards to how valuable an item is - that is, for a given game, the common, uncommon and rare emoticons will all produce the same number of gems when recycled. That number varies between games, though, and between cards, emoticons and backgrounds of a given game. A list of the values of items from a few games can be found on the Gems by game page.
In general, cards are worth 2-20 gems, profile backgrounds 10-100 gems, and emoticons 10-100 gems. It's not worthwhile to recycle trading cards - they're usually more valuable than emoticons (in terms of Steam marketplace value), yet worth fewer gems. In most cases it would likely be more profitable to sell or trade the card for an emoticon or background and recycle that.
Gems can be used to craft Booster Packs for any game that you're eligible for them to drop in. This costs 400-1200 gems per pack, with the gem amount required being inversely proportional to the number of different cards in the set. During the Holiday Sale 2014 event, gems could have also been used to bid on auctions, featuring copies of Steam games. It is unknown right now whether the latter functionality will ever be reemployed; the gem and booster pack crafting remain operable as of late December 2020.
Recycling at least one item into gems grants the "Gem Maker" badge.