When window systems came along, UNIX needed a workaround, so that all the software that was written for ASCII terminals could continue to run in windows.
From the window system side, what it took was a terminal emulator - a program that makes a window act like a terminal. Most emulators imitate a DEC VT100 or VT102 terminal; they respond to its escape sequences, and in general masquerade pretty well.
But there's another side to the equation. The system needs to know what "terminal" a program is running on, so it can read input and send output to the right place. There's normally an association between a tty file and a physical device attached to a serial line. But what's the association for an abstraction on a workstation screen, on a device that's nothing like a serial line?
The answer was to come up with a "terminal-like" construct on the system side. It's called a pty, for pseudo-terminal, instead of a tty.
-