A docking latch, or main latch, was a magnetic structural device found on Galaxy-class starships. The latches served to create the bond between the saucer module and the stardrive section and kept the two separable components joined during standard flight. There were eighteen such latches, all located on the dorsal head of the stardrive section. Their matching ports were found in the docking cavity on the saucer module.
During a saucer separation, the latches retracted from their apertures and became nearly flush with the stardrive section's head, severing the link between the two components of the ship. During a reconnection, the latches worked in reverse. (TNG: "Encounter at Farpoint", "The Arsenal of Freedom", "The Best of Both Worlds, Part II", "Disaster"; Star Trek Generations)