A bain-marie is a water bath used to stabilize and moderate the heat that enters a dish while it is cooking. Since the water can absorb more heat than air, it slows the rise in temperature of the protected dish. This allows a chef more control over the cooking process.
On the stovetop, a bain-marie is used to keep the cooking temperature of a dish low. A double boiler is a cooking vessel suspended over a pot filled with boiling water. Since the vessel is insulated from direct heat and only receives heat from the steam, the temperature can be maintained at a safe and low level for delicate ingredients. Melting chocolate and building sauces like Hollandaise are much easier when using a double boiler as opposed to cooking over direct heat.
In the oven, a bain-marie helps slow the cooking of a dish and keeps the surface moist. The thermal mass of the water reduces the amount of heat energy that enters the food, causing the temperature to rise slowly. This is particularly important in dishes like cooked custard, which can seize and over-coagulate if heated too quickly. The bain-marie allows the cook to bring the custards to the proper temperature slowly and gradually, and the extra moisture inside the oven keeps the tops of the custards from drying out and cracking.