What? They did have onboard sound. The problem is that if you used the motherboard speaker to make anything more decent than a beep, you basically needed to build an entire sound engine from scratch and very few games did so. It also wasn't worthwhile because a shitty two pin speaker could not compare to the speakers of a professional sound system which you needed the soundcard to hook up into, and CPU bandwidth was such a limitation back then than even when games could play WAV they would use MIDI to offload the musical instrument synthesizing for the soundtracks to the sound card. Designing a game that used the onboard sound speaker was basically the realm of assembly hacking geniuses.
It also wasn’t worthwhile because a shitty two pin speaker
All speakers are two pins. 🤔 They were crappy because they were most often little piezoelectric speakers, or otherwise very small where they couldn't play low frequency sounds well.