An assembler translates assembly language into machine code by using a direct correspondence between each mnemonic instruction and a binary pattern for a machine language instruction. It substitutes mnemonic codes with their binary equivalents, translates data constants, and calculates memory addresses.