The basic mechanism is that in a collision-less plasma charged particles are confined to trajectories that are on average parallel to magnetic field lines. In a toroidal configuration the magnetic field lines are closed, i.e. charged particles keep going around the torus and are confined to the volume of the torus. The details are anything but trivial, though. For a simple torus there is a radial drift term stemming from the fact that the field is stronger towards the center than the outside. This has to be compensated with either a ring current in the plasma (Tokamak configuration) or by twisting the field lines (Stellarator).
For plasma with internal collisions there is the thermodynamic collision drift/diffusion term which can't be compensated for. We simply have to make the field strong and large enough to have hundreds of seconds of confinement time. This has been essentially achieved at the cost of making machines with plasma diameters of several meters and $100m^3$ (JET) and $850m^3$ (ITER) of plasma volume.
The internal plasma pressure in these machines is acting on the magnetic field, which transfers it to the magnet rather than the walls of the vacuum vessel. I would venture to guess that the pressure of the magnetic field itself is many times greater than the pressure of the plasma on the field, i.e. the machine design has to accommodate forces from the machine itself more than it has to confine the plasma forces. In ITER this is done with up to 60mm thick structural steel ribs that stabilize the torus that weighs 23000 tons. I would expect potential commercial reactors to be somewhat stronger and more massive than ITER, still.