It's likely that your PowerShell session is timing out. Try the new REST-based cmdlets, which should be more robust: https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps
Get-EXOMailbox -ResultSize Unlimited -Properties RetentionPolicy | select Name, RetentionPolicy
You can also try running it in smaller batches, by filtering the users say per department, etc. Or simply try from a different machine/network, 16k should take just few minutes to return.