The Infinity Stones were six immensely powerful gem-like objects tied to different aspects of the universe, created by the Big Bang from six singularities.
Only beings of immense power can directly wield the Stones, such as Celestials, and the Mad Titan Thanos. Lesser beings would face dire consequences: Johann Schmidt was cursed to Vormir to guard the Soul Stone after touching an active Tesseract, Jane Foster became ill after being exposed to the Aether, Carina exploded when she touched the Power Stone; however, these effects can be reduced if a group is sharing the power among themselves. It is also possible to place an Infinity Stone (or multiple) inside a container to allow the user to wield the Stone's power without suffering the normal repercussions. Examples include the Space Stone inside the Tesseract, the Mind Stone inside the Scepter and later in Vision's forehead, the Power Stone inside the Orb and later the Cosmi-Rod, the Time Stone inside the Eye of Agamotto, the Reality Stone as the Aether, and all of the Infinity Stones housed in the Infinity Gauntlet.
When Thanos successfully collected all of them, he used their phenomenal powers to annihilate half of all living creatures in the universe. He later used the stones' power to reduce them to atoms, as to prevent his work from being undone and to keep himself or anyone else from abusing their power.
Five years later, the Avengers traveled back in time to retrieve the stones from alternate timelines in order to resurrect the victims of the Snap. After the Battle of Earth, Captain America returned the stones to their respective timelines.