An assembler is a program that converts assembly language into machine code. It takes the basic commands and operations from assembly code and converts them into binary code that can be recognized by a specific type of processor.
Assemblers are similar to compilers in that they produce executable code. However, assemblers are more simplistic since they only convert low-level code (assembly language) to machine code.
Assembly language is designed for a specific processor, assembling a program is performed using a simple one-to-one mapping from assembly code to machine code.
A Compiler is a program or set of programs that converts source code written in a high-level language to low-level language (assembly language or machine language).
A Computer understands only binary language and executes instructions coded in binary language. It cannot execute a single instruction given in any other form.
Therefore, we must provide instructions to the computer in binary language. Means we must write computer programs entirely in binary language (sequence of 0s and 1s).
High level language programs are written mainly in English language. So, there was a need of a translator that translates the computer instructions given in English language to binary language.