Self-destruct refers to a mechanism by which a ship or a guided missile can destroy itself. For a ship, this is done to prevent capture; for a weapon, it is done to abort an attack after the weapon has been launched.
Modern warships typically don't have a built-in mechanism for self-destruction; the crew must manually plant explosive charges in critical areas of the ship and detonate them to scuttle the ship. A dedicated self-destruct system would actually represent a security flaw, since it would require only a few traitorous crew members to destroy a warship.
Modern weapons may have self-destruct features to prematurely detonate the warhead upon receipt of a special command code.
Self-destruct in Star Trek
Federation starships have the ability to self-destruct via a computer command. In the 23rd century, executing the command required command codes from at least three officers of the ship, including the Captain. In the 24th century, the requirement was reduced to the consent of both the Captain and First Officer, identified only by biometric recognition. The self-destruct command includes a countdown timer to allow the crew time to abandon the ship; in the 24th century, the countdown time is variable.