Answer: The Gemara (Shabbat 95a) states that one who makes cheese on Shabbat by clumping together milk flakes has transgressed the Torah prohibition of building on Shabbat. Some deduce from this Gemara that it is forbidden to make ice on Shabbat, for one is turning water into a solid form and this constitutes the forbidden work of building on Shabbat.
Nevertheless, Maran Rabbeinu Ovadia Yosef zt”l writes that the aforementioned Gemara does not apply here, for one who makes cheese must collect many pieces of milk with his hands and then turns them into one block by placing them into a single round or square vessel which is indeed similar to building whereby one collects dirt, sand, and wood and creates a single building out of them. Indeed, the Rambam (Chapter 7 of Hilchot Shabbat, Halacha 6) states: “One who collects many different articles and sticks them together until they are one form, this is similar to building.” However, if one places water or juice in a cold place such that they freeze on their own, this is in no way similar to building, for one is not doing any action with his hands.
Another reason Maran zt”l adds for leniency regarding making ice cubes on Shabbat is that the “building” of ice is not something that is long-lasting, for as soon as it is removed from the freezer, it will immediately begin melting as opposed to cheese which can last on its own for a long time. Indeed, the longer it stands, the harder it becomes (as we can see with regards to hard and semi-hard cheeses) until it actually becomes as hard as a rock; this occurrence is certainly comparable to a building which is made to last for a long time.
Thus, halachically speaking, one may place water or any other beverage in the freezer in order to turn it into ice on Shabbat. This is especially true during the summer during which this constitutes enjoyment of Shabbat as well. Hagaon Harav Eliezer Yehuda Waldenberg zt”l (Responsa Tzitz Eliezer, Volume 6, Chapter 34) and Hagaon Harav Shmuel Ha’Levi Wosner zt”l (Responsa Shevet Ha’Levi, Volume 1, Chapter 119) rule likewise.