No, it doesn't. A pair of wireless headphones that use Bluetooth 5.0 won't sound better than a pair that use Bluetooth 4.2 – or rather they might, but it won't be because of their Bluetooth version.
But while the Bluetooth version doesn't affect sound quality, it does make a huge difference to the headphones' feature set. So headphones with later Bluetooth versions can have longer-lasting batteries, greater range, and features like Multipoint which lets you switch seamlessly between wireless devices without having to re-pair each time.
They can also have greater bandwidth, which can enable codecs like aptX HD, a Bluetooth codec capable of wirelessly transmitting higher-resolution audio. So while a later version of Bluetooth doesn't mean better sound quality, it can enable it through its more capable feature set.