A French military source said the hostages were freed after negotiations and that there was no army operation to win their release.
The 32-cabin vessel, which was hijacked on April 4, was anchored off Puntland, a breakaway northern region of Somalia.
French nationals
A French naval warship maintained close surveillance with troops from the French gendarmerie's elite counter-terrorism and hostage rescue unit stationed in nearby Djibouti.
"The president of the republic announces the release of the 30 hostages, including 22 French nationals, of the Le Ponant sailboat, off the Somali coast," said the Elysee Palace statement.
Details of the release operation will be made public after a meeting between Sarkozy and the hostages' families on Friday afternoon.
Bernard Kouchner, the French foreign minister, welcomed the release and said preparations were under way to return the freed hostages to France as soon as possible.
He urged the international community to take action to fight piracy in the Gulf of Aden and off the Somali coast and said talks were under way at the UN on the issue.