The existing answer is accurate but somewhat lacking in detail.
Z-Moves are described by official sources as being moves of "great power" that may take place when "the trainer and Pokemon’s wishes resonate with each other". Z-Moves may only be used once per battle, and they require various different items to be equipped to be used successfully. In this way, they are not unlike Mega Evolutions: it might be easier to envision them as Mega Evolutions except in the form of a move.
In order for a Pokemon to use a Z-Move, its trainer must be in possession of an item called a Z-Ring. For a Z-Move to happen, this Z-Ring must be equipped with a Z-Crystal that corresponds with the type of move that should be used. For example, the Z-Crystal called "Waterium Z" will trigger the Water-type Z-Move called "Hydro Vortex". It is assumed that there will be equivalent Z-Crystals and Z-Moves available for every different type in the game.
In addition to these requirements, the Pokemon itself must also be capable of using the Z-Move. In order to use a Z-Move, the Pokemon must be holding the same Z-Crystal that its trainer does in their Z-Ring, and must also know a move with the same type as the Z-Move it is trying to use. It is assumed that if the Pokemon and its trainer do not meet these requirements, they will not be able to use Z-Moves at all.
In addition to the type-specific Z-Moves confirmed, there are also Z-Moves confirmed that will be available for specific Pokemon only. For example, if a Snorlax and its trainer are equipped with the "Snorlium Z", the Snorlax will be able to use the Z-Move "Pulverising Pancake". Similarly, Alolan Raichu can use the Z-Move called "Stoked Sparksurfer".
Currently, only the Electric, Water, Grass and Fire-type Z-Moves and the Pokemon-specific Z-Moves have been formally addressed by the Pokemon Company, though gameplay of other presumed Z-Moves has been displayed in official English and Japanese trailers. Further details can be found on Bulbapedia, and information direct from the Pokemon Company can be found on the official Sun and Moon website.