Which laws says it is illegal?
The 1923 Treaty of Lausanne does not as far as I can see.
The legal instruments setting up a demilitarized status for the Eastern Aegean Islands can be summarized from an historical perspective as follows :
a)
1913 Treaty of London : The future of the Eastern Aegean Islands have been left to the decision of Six Powers in Article 5 of the Treaty of London.
b)
1914 Decision of Six Powers: The islands of Lemnos, Samothrace, Lesvos, Chios, Samos, and Ikaria and others under Greek occupation as of 1914 were ceded to Greece by the 1914 Decision of Six Powers (Great Britain, France, Russia, Germany, Italy and Austria-Hungary) on the condition that they should be kept demilitarized.
c)
1923 Lausanne Peace Treaty: In Article 12 of the Lausanne Peace Treaty the 1914 Decision of Six Powers was confirmed.
Article 13 of the Laussane Treaty stipulated the modalities of the demilitarization for the islands of Lesvos, Chios, Samos, and Ikaria. It imposed certain restrictions related to the presence of military forces and establishment of fortifications which Greece undertook as a contractual obligation to observe stemming from this Treaty.
The Convention of the Turkish Straits annexed to the Laussanne Treaty further defined the demilitarized status of the islands of Lemnos and Samothrace. It stipulated a stricter regime for these islands, due to their vital importance to the security of Turkey by virtue of their close proximity to the Turkish Straits.
d)
1936 Montreux Convention: The Montreux Convention did not bring any change to the demilitarized status of these Islands. With the Protocol annexed to the said Convention, the demilitarized status of the Turkish Straits has been lifted to ensure the security of Turkey. In the Montreux Convention there is no clause regarding the militarization of the islands of Lemnos and Samothrace.
e)
1947 Paris Peace Treaty: The demilitarized status of Eastern Aegean Islands was once again confirmed in 1947 long after the Lausanne Treaty. The "Dodecanese Islands" namely Stampalia, Rhodes, Calki, Scarpanto, Casos, Piscopis, Nisiros, Calimnos, Leros, Patmos, Lipsos, Symi, Cos and Castellorizo were ceded to Greece on the explicit condition that they must remain demilitarized (Annex 6).
The demilitarization of the Eastern Aegean Islands was due to the overriding importance of these islands for Turkey's security. In fact, there is a direct linkage between the possession of sovereignty over those islands and their demilitarized status. Greece, in this respect, cannot unilaterally reverse this status under any pretext.
The above mentioned international treaties which are in force and thus binding upon Greece strictly forbid the militarization of Eastern Aegean Islands and bring legal obligations and responsibilities to Greece.
However, despite the protests of Turkey, Greece has been violating the status of the Eastern Aegean Islands by militarizing them since the 1960's in contravention of her contractual obligations. These illegal acts of Greece have increased considerably over the last years and became a vital dispute between the two countries. It is worthwhile to recall that Turkey's several appeals to Greece to respect the demilitarized status of these Islands have been disregarded so far.
From a mere point of view to respect international law, it should be underlined that Greece also introduced a reservation to the compulsory jurisdiction of International Court of Justice on the matters deriving from military measures concerning her "national security interests" when she accepted the Court’s jurisdiction in 1993. In so doing, Greece aims to prevent a dispute concerning the militarization of the islands to be referred to the International Court of Justice.