How strong is the force of ice expanding when freezing? Why does water contract on melting whereas gold, lead, etc. expand on melting? reminded me about something I've been wondering myself for some time.
We know that water expands as it freezes. The force is quite formidable - it can cause solid steel pipes to rupture. But nothing is limitless. If we created a huge ball of steel and placed a small amount of water inside it (in a small, closed cavity) and then froze it - I don't think the big ball would rupture.
But what would we get? Compressed ice? Can this even be done? Can you compress ice? Or would the water simply never freeze? Or freeze only partially? What if we kept cooling it, down to absolute zero (or as close as we can get)?
What happens when water should expand, but there is no room for it to do so, and the container is too strong to be deformed?
 A: About energy conversion in the process:
If the principle of conservation of energy holds good then energy is converted only, in that sense the work
done by expanding cannot exceed the energy difference that corresponds to the temperature difference.
The best you can possibly do is break even.

Let's say you have some natural source of temperature difference. Let's say you are near a hot spring in a polar region (hot springs like that probably exist in Iceland).
So you can set up heat exchangers, cycling between cooling something and heating it back up.
Even if you get the temperature cycling essentially for free: it doesn't lend itself at all to harvesting energy. The force is large, but the mechanical displacement is very small.
A dynamo requires lots of revolutions. I don't see a practical way of turning such a small mechanical displacement into larger displacement (with corresponding smaller force) so that you can get a dynamo spinning at a sufficient rate.

Maybe the following is a possibility:
Let's say there is a quarry with a type of stone that has a lot of cracks. It may be economic to do the following: bring in heat to get the rock above freezing point so that you can pour water in the cracks and then take the heat source away so that the rock-with-water-in-the-cracks goes below zero again.
That is probably more energy efficient than using heavy machinery.

In fact, there are products on the market called 'demolition grout'.
You drill a row of holes, you mix the grout with precisely the right amount of water, and you fill the holes with that mix.
The chemistry of the grout is such that it binds with the water, and then it ondergoes a recrystallization into a form that takes up more volume.
A: The other answers are excellent in explaining the theory.
There is a good Youtube video "Can You Stop Water From Expanding When It Freezes Into Ice" showing a practical experiment trying to contain freezing ice in a steel pipe, and then explaining the pressures required to contain freezing ice.
I don't have the reputation to comment, which is why I wrote this as an answer. Apologies if this was wrong.
A: 
But what would we get? Compressed ice? Can this even be done? Can you compress ice?

Absolutely; all passive materials can be compressed. The bulk modulus, a material property with units of pressure, couples the applied pressure to a relative reduction in volume. The bulk modulus for ice at 0°C is around 8 GPa, which means that about 8 MPa or 80 bar pressure is required for a -0.1% volumetric change.

What happens when water should expand, but there is no room for it to do so, and the container is too strong to be deformed?

Here, a phase diagram for water is useful. The discussion in Powell-Palm et al.'s "Freezing water at constant volume and under confinement" includes a volume–temperature phase diagram:

From this, we can predict the equilibrium response when heating or cooling water at constant volume (by moving vertically) or compressing or expanding water at constant temperature (by moving horizontally). We find that at constant volume (moving vertically downward from 0°C and 1 g/cc), over 200 MPa and 20°C undercooling is required* to get even a 50% slush of water and ice.
Let's zoom out a little. From Powell-Palm, "On a temperature-volume phase diagram for water and three-phase invariant reactions in pure substances," we find that 209.9 MPa is ultimately required* for complete solidification, into a two-phase region (at equilibrium) of ice-Ih (ordinary ice) and ice-III:

(Note that "0.00611 MPa" should read "0.000611 MPa"—the authors missed a zero.)
We can interpret this as the compact structure of ice-III providing a solution to the problem of ice-Ih being anomalously voluminous. We find from the temperature–pressure phase diagram of water that this ice-III nucleates (at equilibrium) upon cooling to 251 K, or -22°C:

With further cooling, the ice-I–ice-III mixture transforms* to ice-I–ice-II, then to ice-IX–ice-II, and then to ice-XI–ice-IX. (How can this be determined, since the volume–temperature chart doesn't include any of that information? It's from the horizontal line on the temperature–pressure chart and the knowledge that ice-I and ice-XI have specific volumes of >1 g/cc and that ice-II, ice-III, and ice-IX have specific volumes of <1 g/cc; thus, a higher-density and lower-density combination is required to maintain a constant 1 cc/g, and we can't move an iota above or below that two-phase line upon cooling at constant volume.)
Note that no power can be generated under the condition of constant volume, as no displacement occurs. And although there's no thermodynamics prohibition about allowing the system to expand and do useful work, you would have to heat it up again to liquefy it to repeat the process, and this would use up the energy you gained.
*Note that this answer always refers to equilibrium phase predictions. Sufficiently rapid cooling involves kinetic limitations that delay or essentially even preclude phase transitions. For example, liquid water can be cooled fast enough that crystals essentially never form even though the thermodynamic driving force is large. Here, the solid water is said to be in a glassy or amorphous state.
(See also the fun rotatable 3D phase diagram of water here.)
A: Summary:
Per Chemomechanics’ Answer, to -22C:
It will cool as water at room pressure and temperature and volume (and hence room density) to 0C. Then as it is cooled it goes from 0C water to 0C ice-water at around 10 atmospheres. Then it will cool to -22C as a mixture of water and ice, and it will take over 2,000 atmospheres of pressure to keep it at same volume/density. At -22C it finally becomes all ice.
Below Chemomechanics’ Answer Down to 0K:
Then it will cool as a combination of regular ice and ice-III (tetragonal crystalline ice) (somewhere around half each) to -38C, quite surprisingly staying at about that same pressure (as it cools not much more pressure above the 2,000 atmospheres is needed to hold its volume constant). Then it becomes a combination of regular ice and ice-II (rhombohedral crystalline form of ice with a highly ordered structure, also somewhere around half each), still at about the same pressure. Finally, below ~165K, the combo is regular ice and ice-IX, and this cools to 0 K, surprisingly again at around the same pressure (~2000 atmospheres).
So: From 0C water to 0C ice/water combination, at the same density, pressure goes from 1 atmosphere to over 10. Then from 0C to -22C, pressure increases to 2,000 atmospheres and it finally becomes all ice at that point. Then pressure doesn't increase much all the way to absolute zero.

How I determined this and more detail
A large metal ball can still deform locally, even if infinite radius. It wouldn’t burst but it would change shape, because the force is large.
That said we can imagine cooling water holding volume constant. If you have a constant mass of H2O and a constant volume then you have a constant density. And a constant “specific volume”, which is 1 / density.
Cooling to -22C:
I will refer to the expert Chemomechanics’ long answer above with pics and explain it for a layman, as far as it goes (it goes to -22C, 210Mpa, which is the first point of 100% ice, and then stops). Then I’ll answer the rest.
Look at his answer and find this text and the pic above it: “From this, we can predict the equilibrium response when cooling water at constant volume. We find that at constant volume (moving vertically downward from 0°C and 1 g/cc), over 200 MPa and 20°C undercooling is predicted to be required even to get about a 50% slush of water and ice.”
What he’s saying is that if we had 1g of water and hold the volume constant at 1 cc, then we have a density if 1 g/cc and a specific volume of 1 cc/g (or any amount of water held at that density), and that is the density of water at room temp and pressure. That’s why that particular specific volume is what our problem is. Temp and pressure can change but not specific volume. The figure says kg/cc, and then adds “times 10^(-3)”; would be simpler to just say g/cc.
So if we start at room temp and pressure of 30C it is water at 1 cc/g. That point would be above what the image covers. And as we cool and go straight down, above what what the image covers, density remains constant at 1 and so does the pressure until we get to 0C, and that point is on the image, at the top. It is where water and ice meet and freezing starts. Point coordinates (1, 0C).
Now we have two paths to imagine from that point (1 cc/g, 0C):

*

*Hold pressure, not volume, constant and cool it. This is the normal case. That would be moving horizontally to the right. The density decreases (it expands) and goes through ice-water and becomes ice at 0C and ~1.08 cc/g. Temperature doesn’t decrease even when cooling until it is all ice. Then further cooling at room pressure would make the ice lower temp.


*Our problem: hold specific volume constant at 1 and cool it. This means going straight down. And to reduce temperature even just 20C requires 200Mpa of pressure! and it wouldn’t even be ice yet – a mixture. That’s 2,000 times atmospheric pressure to hold the density (volume) constant. And that is enough to permanently deform any metal so it wouldn't happen that way. You could use silicon nitride, it wouldn't give much at all (any real material would give some, but we proceed pretending it can be done).
Then he’s saying continued cooling would increase pressure more, up to 209.9 MPa, and it would be all ice then, at -22C (251K). Then he ends his answer.
From -22C to 0K:
Then surprisingly the pressure doesn’t increase much to hold that density. In the second figure we go straight down at a specific volume of 10, which is our situation in different units (note the little 10^(-4) in the lower left). It goes straight through the middle of the region which is the mixture of regular ice and ice-III (tetragonal crystalline ice) and then through the middle of the region of regular ice and ice-II (rhombohedral crystalline form of ice with a highly ordered structure). Now see third figure. Finally, below ~165K, the combo is regular ice and ice-IX.
In the third figure, all of this below -22C is the line between those phases, and it is horizontal!!! at around 200Mpa all the way to absolute zero, meaning approximately constant pressure. How do we know we stay on that horizontal line and don’t go into pure ice-II or a combo of ice-II and ice-IX? Because the densities of II, II, IX are well below 1. So it takes the combination of ice-IL or ice-IH with its higher density (lower specific volume) and one of the other ices to stay at density of 1. Meaning we stay on that horizontal line in the third figure.
Below 65K, the regular ice portion changes to ice-XI, which also has a density below 1 and is really just a different form of ice-IH. The density of all of these are (very roughly) the same distance from 1 (whether above or below) so the phase mixture is (roughly) around half each in every case on the way down.
