The mechanism was that 1 UST (the stablecoin) is redeemable for USD$1.00 worth of LUNA (the volatile coin), at whatever the LUNA/USD exchange rate is at that point in time, and vice versa. So in theory, if LUNA was trading for $10.00 then you could exchange 1 UST for 0.1 LUNA, then sell that 0.1 LUNA on an exchange to get USD$1.00. It works in the other direction too. Arbitrage maintains that peg.
Of course, the flaw in this whole arrangement, is that if LUNA is in a death spiral and money is only really flowing out of UST/LUNA, then the peg is not maintained.