So FSTSW AX was handled by the CPU microcode, which would read the status word from a reserved I/O port and put it into AX.
The 386 was even more tightly integrated, with some of the FPU state duplicated inside the CPU, so that it could store it to memory in different formats depending on whether it was currently in 16- or 32-bit mode.