When the tws headset is connected on the system bluetooth, there will be a prompt suggests to AppStore install the APP, Just like this:
How they did it?
They did it by having a Bluetooth device that is part of the MFi program (https://mfi.apple.com) MFi devices can launch apps they are related to, and if the app is not installed, the system will show this prompt.
This requires you joining the MFi program, and create a Bluetooth Classic (BLE not eligible) accessory that can interact with an app using the External Accessory framework (not Core Bluetooth)
You can find more information about the MFi program at the above link.