Known in the past with the names of Sancta Maria De Balneo or Sancta Maria ad Balneum, the locality has been inhabited since ancient times as evidenced by the numerous archaeological finds from prehistoric times (arrowheads, lamellae, ceramic shards and more) found in the nearby "Grotta del Fico".
It probably developed initially as a small fishing village later also inhabited by the Messapians and Romans. The numerous rock-cut tombs found on the hills just outside the town can be traced back to the Messapian period. In 272 BC Santa Maria, like all of Salento, fell under the control of the Romans who built the “Emporium Nauna” port, the thermal buildings with the baths.
In the 12th century, the important residence of the Teutonic Knights was present in Santa Maria, consisting of an abbey and a large monastery. For this reason the town was also an important stopping place for pilgrims from the Crusades.
In the Middle Ages, after repeated attacks and looting by pirates and Saracens, it was gradually abandoned. The Saracens destroyed the buildings, the church, the spas and the pools. Even the Venetians after the fall of Gallipoli in 1484, raged on the city. The surviving inhabitants took refuge in the inland villages.
In the 16th century, Charles V, as part of the coastal defense program, had the tower of the Galatena River built, to defend the fresh water springs present in Santa Maria, but which the pirates of the time knew and used to supply themselves with fresh water.