Hello,
It seems that the current version of the Remote Desktop Client (10.5.8) may not fully support the recent upgrade to iPadOS 18.0, leading to the issue you're experiencing with your Magic Keyboard on both Windows 10 and 11 connections. Unfortunately, this problem is not unique to you, as other users have also reported similar difficulties. You can find related discussions in threads like this one: IPadOS 18 Developer Beta RDP Client issue - Microsoft Community Hub.
Until the Remote Desktop Client receives an update addressing this compatibility matter, we're limited in our immediate actions. However, you can provide feedback directly to the developers. To do so, navigate to the app's Settings and select 'Submit Feedback.' Your input, along with others', can significantly raise the priority of this issue for the product team, potentially a fix.
I understand this situation may be inconvenient, and I appreciate your patience while awaiting an update. If there are any alternative solutions or workarounds that emerge, I'll be sure to share them with you.
If the Answer is helpful, please click Accept Answer and upvote it.