Most people don't need to buy a sound card, but certain use cases can benefit from adding one.

Many eons ago, in the '80s and '90s, a dedicated sound card was a must-have for any PC gamer or musician. Your machine's built-in hardware was limited to bleeps and bloops, or at best some convoluted tricks to fudge low-res samples. Just having music and effects that didn't grate on your ears was a major advancement. You'd no more consider skipping a sound card back then than you would a 3D graphics card today.
As you've probably noticed, though, dedicated sound cards seem to have dropped off the radar. They are still a thing, yet even the one-time king of PC audio, Creative, seems to have relegated them to a sideshow. That might seem odd, given that in some ways, sound matters more than ever. It's common for media to be mixed for spatial audio formats like Dolby Atmos, which position sound "objects" in 3D space. There's also a push for lossless audio in both movies and music. Either of those can place serious demands on pipelines, as home theater owners will attest.
Standing on the outside, then, you might be understandably confused. Does a sound card still meaningfully improve audio quality? Should you consider one when building or upgrading a PC rig? The quick answer is that most shoppers can safely skip one, although there are cases when a separate audio interface is mandatory.
Why you probably don't need a dedicated sound card for your PC

PC audio technology is no longer an afterthought, as it was in the '80s. It's taken for granted that anyone unboxing a Windows PC — or a Mac or Linux machine, for that matter — will be playing music, games or video almost immediately. That means integrating the necessary hardware for processing inputs, outputs and codecs. There are a variety of ways you can achieve that, but advancements in die sizes and chip design in general mean that what once required an entire card can be compressed into a single chip on your motherboard. If you've ever seen a mysterious Realtek Audio reference in the Windows Device Manager, that's the sort of chip we're talking about. Other chipmakers exist, but Realtek is surprisingly commonplace on Windows PCs.
Sound cards also used to be vital for microphone inputs and 3.5mm speaker outputs, but no more. Those have also been integrated into motherboards, and in many circumstances, they've become irrelevant. High-quality audio (including lossless) can easily be delivered over USB 3.x, DisplayPort, Wi-Fi or HDMI. When more compression and a little lag are acceptable, there's Bluetooth. A 24-bit, 192kHz Dolby Atmos stream in Dolby TrueHD lossless only consumes about 18 Mbps, a fraction of the 5 Gbps bandwidth USB 3.0 is capable of, never mind USB4 or Wi-Fi 7.
As if this weren't enough, there are business- and design-related incentives to move audio hardware out of your PC case. Number one is space. Laptops and handheld PCs obviously have little room to begin with, especially with never-ending competition to make devices thinner and lighter. In desktop tower PCs, much of the case may already be filled by a gigantic graphics card and its cooling systems. Any redundant cards are just going to increase power consumption and restrict airflow.
For professional audio, the inside of a PC is also a relatively unfriendly place, since all of the surrounding components can potentially introduce signal interference. It is possible to provide enough shielding, as the continued sale of internal sound cards points to. But for optimal results and more convenient interfaces, it's just logical to keep most pro sound gear out on your desk.
When a sound card actually makes sense

With most consumer-level audio taken care of, the one area where sound cards reign supreme is in tandem with professional audio interfaces. These setups tend to support even higher fidelity than integrated chips, which may be required for mastering and production. And as we just noted, they enable more convenient controls with less risk of interference. If you're going to connect mics, pedals, guitars and keyboards to your PC on a regular basis, it would be ridiculous not to put those inputs and their knobs out in the open.
There is one aspect to modern sound cards that both pros and media connoisseurs can potentially benefit from: headphone amplification. Your motherboard may lack the power to handle high-impedance headphones, which offer extra precision for those who need it or simply enjoy it. And with an external add-on, you can potentially switch high-end headphones from device to device in a matter of seconds.
The gist is that if you're just trying to listen to music or play games, there's no real incentive to splurge on a sound card. With the right set of speakers or headphones, there's usually nothing stopping you from getting spatial or lossless audio from your PC's built-in equipment. It's only wealthy purists or people aiming to be the next Hans Zimmer or Aphex Twin who need to step up their tech.