Is it permissible on Shabbat to fill an ice cube tray with water and put it in the freezer to make ice cubes?
Rabbi Chayim Palachi (Turkey, 1788-1868) in Shut Lev Hayim, Helek 2, siman 182, ruled that making ice cubes, which entails converting a liquid into a solid, is akin to producing cheese from milk, which is forbidden on Shabbat on the grounds of "Boneh" ("building"). Just as one may not convert milk to cheese on Shabbat, so would Halacha forbid transforming water into ice. A number of other authorities ruled stringently on this issue, as well.
Chacham Ovadia Yosef in Halichot Olam, Helek 4, page 93, however, argued that making ice cubes differs fundamentally from producing cheese. For one thing, the process of transforming milk to cheese is done actively, with one's hands, whereas water transforms into ice naturally when exposed to cold temperatures. At most, this would be a situation of "Gerama" the indirect performance of a Melacha (forbidden activity on Shabbat). Secondly, cheese retains its solid form permanently, and thus making cheese justifiably qualifies as "Boneh." Ice, however, transforms back into water if left outside the freezer, and thus making ice cubes is but a temporary transformation, which does not qualify as "Boneh." Therefore, Chacham Ovadia rules that one may make ice cubes on Shabbat with intent to use the ice on Shabbat. (See Yehaave Daat, Helek 1, siman 30.)
Is it permissible to return an ice tray to the freezer on Shabbat if one will not need any more ice on Shabbat, or would this constitute "Hachana," preparing from Shabbat for the weekday, given that he places the tray in the freezer solely to preserve the ice for the following day?
A fundamental principle of "Hachana" states that this prohibition applies only when one's intent is to save time after Shabbat. For example, Halacha would forbid making beds or washing dishes for the purpose of saving time after Shabbat. One may, however, do something on Shabbat that is necessary to preserve a given item. For example, one may return food into the refrigerator after his meal even though he will not need the food until after Shabbat, since he does so simply to preserve the food. Likewise, one is allowed to move an article out of the sun on Shabbat if it would be ruined by exposure to sunlight. Similarly, one may return an ice tray to the freezer on Shabbat even if he will need the ice only after Shabbat, since this is done for the purpose of preserving the ice cubes, and not to save time after Shabbat. (See Menuhat Ahava, Helek 1, page 248.)
Summary: One may fill an ice tray with water and put it in the freezer to make ice on Shabbat with intent to use the ice on Shabbat., and one may return an ice tray to the freezer on Shabbat even if he will not need any more ice until after Shabbat.