In a method of this kind known from CH 409 831, the workpiece to be formed, e.g., a tube, is inserted into a form and filled with water. A device that comprises a multiple number of electrodes and that is intended for generating and igniting a detonating gas is packed in an elastic container, e.g., a plastic bag. This is placed inside the workpiece, sunk so deeply in the water that the bag lies completely below the surface of the water. By activating two electrodes, detonating gas is generated under water, and this gas collects in the surrounding bag. By using a sparking plug or a heating wire to ignite the detonating gas produced in the bag, a pressure wave is produced in the water, and this pressure wave presses the workpiece into the form. This method is, however, costly and time-consuming.