In Bitcoin, wallets do not actually store coins. Wallets hold private key material that enables the user to spend specific Unspent Transaction Outputs (UTXOs) that are tracked on the blockchain.
Hardware signing devices generally do not have the capability to process the blockchain. Therefore they cannot by themselves learn which UTXOs are owned by the user. This is where the software wallet comes into play: The software wallet keeps track of a “watch-only” wallet and therefore learns about the UTXOs and transactions relevant to the user. This information is used to create transactions. The hardware signing device only keeps track of the private key material and will provide signatures for the transaction created by the software wallet. To that end, the transaction needs to be presented in a specific format to the hardware signer’s interface. This translation layer is usually implemented in some software wallets.
The keys do not need to leave the hardware signing device. Rather the partially signed (or unsigned) transaction is transferred to the hardware signing device, the hardware signing device adds the relevant signatures, and the signed transaction is returned from the hardware signing device to the software wallet. There are various ways to get the transaction data to the hardware signing device, the simplest is to plug it into the computer with the software wallet, but some hardware signers e.g. read animated QR codes, or some users create the transaction on the online device and use a separate airgapped offline device to connect to the hardware signing device.