Calling it an emulation might be selling it under value. There is way more upward compatibility included than just software.
Essentially the PS2 contains a full PS1 subsystem sans the GPU. It might be better to think of the PS2 as like a Macintosh 630 with a 486 DOS card, having all the hardware of a PC except for the video card. With its new GPU being a superset of the PS1 GPU and a much faster main CPU handing the GPU commands in time, including scaling and improving wasn't rocket science.
For development history, there's a nice write up from the main(?) developer of the compatibility mode software (Here's an English translation).
... really good, despite the modest hardware of the PS2 [...]
It's still about 8-10 times the bare CPU speed, not to mention a more than capable but compatible CPU, but ...
As far as I know, the PS1 had its unique CPU, I/O, GPU, Video codec, and SPU hardware components.
True, and the PS2 included exactly that PS1 CPU as I/O processor, as well as the Sound Processor as SPU#2, both reducing the effort by far.
The I/O Processor was exactly the same design as the PS1, including Geometry Transformation Engine (GTE) and Motion Decoder (MDEC). It also had its own 2 MiB RAM, doubling as PS1 RAM during 'emulation'. To work cycle-accurate the I/O processor was clocked down from 37.5 MHz in PS2 mode to 33.8688 MHz in PS1 mode. The I/O Processor also had his own link to the PS1 compatible SPU#2.
There was no need to create an emulation or even just a translation layer for CPU, GTE, MDEC or SPU related code. That already relieved all constraints of emulating either component, leaving only the graphics complex to be done.
Here, a software layer running on the main PS2 CPU intercepts all commands and data handed from PS1 CPU to PS1 GPU and hands it to the PS2 GPU - possibly with parameter translation and additional data in case of upscaling and/or additional filtering for better graphics.
This leaves only non timing critical components like controller-I/O to be translated. Sure, for a human player a millisecond may be fast and important, for a 300 MHz CPU it's nothing of concern :) Same goes for save cards and other additions.
Here BTW lies the other part where the PS2 can improve PS1 games: Loading speed. The PS2 can read about 12 times faster from CD-ROM than the PS1 (24x vs. 2x). IIRC the PS1 mode had a feature to disable this as some games wouldn't work proper when data came too fast.
(But SCPH-7500x ...)
While the first PS2-Slimline version is 'only' a more compact package of the original model, its later (2005) V14 (SCPH-7500x) incarnation is a new hardware design replacing several hardware components by new implementations or complete different ones. For example the I/O-Processor was replaced by a complete different architecture.
Since the original I/O-CPU was at the core of the emulation it needed to be replaced by one running on the main CPU. Thanks to code compatibility (the PS2's R5900 is mostly upward compatible to the PS1's R3000) and it's way higher speed (300 MHz vs. 34 MHz) a workable emulation in Software was possible.
The hardware (and software) change wasn't a perfect one, resulting in a large number of troubled games. Not just many (>150) PS1, but as well PS2 titles.
Bottom line, the Slimline PS2 models of V14 (SCPH-7500x) and later are a complete different machine. less compatible than the PS2 before.