This sounds more like a Bluetooth interference or macOS Bluetooth problem than a limitation on the number of devices the iMac can support.
The most important clue is that both audio streams work perfectly when the Apple Magic Keyboard is either disconnected or connected through its Lightning cable.
That strongly suggests the keyboard’s wireless connection is involved, although it does not necessarily mean the keyboard itself is defective.
Bluetooth and 2.4 GHz Wi-Fi share the same frequency band, and interference can cause audio stuttering even when a setup has worked reliably for years. Turning off Wi-Fi and seeing no improvement does not rule out interference from other sources, such as USB 3 devices, hubs, external drives, or nearby electronics.
I would try the following, in this order:
- Restart the iMac completely. Shut it down, wait about 30 seconds, and start it again. This helps rule out a temporary Bluetooth or macOS problem.
- Check for nearby interference. Temporarily disconnect USB hubs, external drives, and other peripherals, especially USB 3 devices. Move them away from the back of the iMac and test again.
- Check the keyboard’s battery and connection. Fully charge the Magic Keyboard, switch it off and on, and test again. Apple’s guide explains how to troubleshoot connection problems: If you can’t connect your Magic Keyboard, Magic Mouse or Magic Trackpad to your Mac.
- Test each audio device separately. Connect one Bluetooth audio device, then the second, and finally the keyboard wirelessly. This can help establish whether the problem occurs only when all three connections are active.
- Check whether an application is using the microphone. If your Bluetooth headphones have a built-in microphone, close applications that may be using it and test again. Apple explains this issue here: If sound quality is reduced when using Bluetooth headphones with your Mac.
- Test with a fresh macOS user account. If the problem disappears there, a user-specific setting or background application may be involved.
Apple also provides guidance on identifying wireless interference: Resolve Wi-Fi and Bluetooth issues caused by wireless interference.
Since this is an iMac running macOS High Sierra 10.13, some troubleshooting options may differ from those described in Apple’s current support articles.
My practical workaround would be to keep the Magic Keyboard connected by Lightning, since you have already confirmed that this restores normal audio.
This is a useful diagnostic clue: the problem appears when the keyboard uses its wireless connection, rather than when it is connected by cable.
If the issue persists after restarting and eliminating nearby interference, the next step would be to investigate the iMac’s Bluetooth software or hardware. Repeatedly re-pairing the keyboard is unlikely to help if the underlying cause is elsewhere.
The key question remains: did the stuttering start spontaneously, despite no changes to the setup, or did it begin after a macOS update, restart, or addition of a new USB device?