One who cooks on Shabbat by bringing food in contact with water that was heated by a flame has violated the Torah prohibition of cooking, exactly as if he or she had put the food directly over a flame. This is because in terms of halacha the "consequences of a flame" are the same as the "flame" itself. But this is not true if the sun was the source of the heat. One is permitted to use direct sunlight to cook food. On the other hand, a rabbinical decree prohibits cooking with sand or water that was heated by the sun (the sages said that the "consequences of the sun" are not the same as "the sun itself"). The reason for this decree is a fear that people might mistakenly equate a medium heated by the sun with one that was heated by a flame (and thus violate a Torah prohibition).
One common modern device that uses energy from the sun for cooking is the solar water heater. Cold water from the bottom of the heater flows through pipes in the collector (a dark surface that absorbs solar heat, covered by a glass plate to prevent the heat from escaping), is heated, and returns to the upper section of the heater. The hot water does not mix with the cold water in the tank because of the tendency for hot water to rise with respect to colder water.
Is water heated in the solar collectors considered as having been heated by the sun so that it can be used on Shabbat?
Rabbis of our generation do not agree about this, and various problems have been raised. Some argue that since the water is heated in the collectors and not directly by the sun's rays it must be considered as a "consequence of the sun," and its use is forbidden by rabbinical decree. Others are wary of the process of returning the hot water to the tank, where it might mix with the original cold water and cook it (and this water is definitely considered a "consequence of the sun," so that its use is forbidden by rabbinical decree). Others feel that since modern solar heaters include backup electric heating elements people might make a mistake and permit using the electric heater on Shabbat (just as the sages prohibited "consequences of the sun" because it might be replaced by "consequences of a flame").
Is One Really Allowed to Cook Directly in the Sun?
There are those who explained that the reason cooking in the sun is permitted is that this is not a usual practice (Igrot Moshe). This would imply that any common equipment which uses solar energy for cooking should be considered the same as a direct flame and is therefore prohibited by Torah law! And for this reason, some rabbis forbid the use of a solar water heater. However, most rabbis feel that solar cooking is not defined as cooking at all, because the sun is not a flame (noting that solar cooking was not used in building the Tabernacle, but a real flame was).
Cooking With Other Energy Sources, Not a Flame
Just as according to most rabbis cooking without a flame is not prohibited by Torah law, there are other energy sources which are beyond the scope of the Torah definition of cooking. This includes a microwave (without browning), induction heating, a chemical reaction, expansion or contraction of a gas, and using electrodes (as in a vaporizer). The Zomet Institute utilizes this fact in order to provide hot food for babies and sick people in hospitals using a Shabbat microwave, which operates on the principle of gramma (indirect action).
For more information (in Hebrew):