Why does a Sallen-Key low-pass filter improve ripple in my PWM to DC voltage converter circuit?
The RC filter in your first diagram has a &quot;1st order response&quot;.

The Sallen Key op-amp filter has a &quot;2nd order response&quot;.


This means, that for the same cut-off frequency (3 dB point), the 2nd order filter has a significantly better ability to attenuate high frequencies in the &quot;stop-band&quot;: -

Image from here.
The red trace is a first order filter and the blue trace is a 2nd order filter and, at any arbitrary point in the spectrum above the 3 dB point, the 2nd order filter produces a much higher attenuation of unwanted AC signals such as your PWM waveform.

What exactly is happening with the Sallen-key that makes it have less
ripple??

It's still there but to a much lesser extent.
For the 1st order circuit it is the capacitor charging and discharging via the input resistor. But, for the 2nd order filter there an identical cascaded RC filter that both significantly attenuates the ripple seen in the first order circuit and reshapes it to be more sinusoidal so, if you homed in on the 2nd order output waveform you would see a small sinewave type ripple voltage.