This post didn't get much attention, so I don't know if it's worth posting the answer, but I did find a solution.
I didn't know when posting this that the solution is dependent on the version of Android. In my case, the phones have Android 9 (Pie).
The command that I found to turn on/off SIM cards is:
adb shell service call phone 180 i32 X i32 Y
where X is the SIM card number (1 and 2, in my case) and Y is 1 for enable and 0 for disable.
If anyone is interested, I found the solution by digging through source code on android.googlesource.com. Once I found the interface for ITelephony (it was a .aidl file), I had to count the functions, because the number 180 in the command meant the 180th function in that file. I also derived the arguments i32 X i32 Y from the arguments to that function. The answer here helped me a ton: https://stackoverflow.com/questions/20227326/where-to-find-info-on-androids-service-call-shell-command.