The prefix code is a code unique to each Federation starship; in the 23rd century, it was a non-repeating sequence of five digits. It is apparently part of the coded message sent from a console through the ship's computer network to accomplish a task. If the code is attached to a command transmitted from one starship's console to the computer system on another starship, it allows remote operation of the second ship. Federation starships keep records of prefix codes for other Starfleet ships in their databases.
The prefix code was used by Captain Kirk in The Wrath of Khan as a desperate attempt to gain a temporary tactical advantage against Khan. Khan, lacking formal training in starship command, was unfamiliar with the prefix code. The code allowed the Enterprise to remotely lower Reliant's shields, providing an opportunity to disable the Reliant's weapons with phaser fire. Khan was unable to override the command locally before the Reliant sustained heavy damage.
In TNG "The Wounded", Picard reveals the prefix code of the USS Phoenix to the Cardassians to help them prevent an attack on a Cardassian cargo ship. Worf claimed that the prefix code would allow a Cardassian warship to disable the shields of the USS Phoenix. This apparently did not occur, as the Phoenix sustained negligible damage and subsequently returned fire, destroying the Cardassian vessel. Presumably, either the Phoenix's crew altered the prefix code; the Phoenix's crew overrode the Cardassian remote command; or the Cardassians failed to use the prefix code correctly.
Potential security concerns
If prefix codes still use a five-digit format in the TNG era and beyond, a brute force attack may allow an attacker to lower a Federation starship's shields, depending on computer security measures. However, a prefix code exploit can be defeated by bridge crew with a manual override, or the code can be altered when it is suspected of being compromised.