You can’t. Once they’re given command they are in command.
Actually I found out how you can.. it is a little strange but it works....
Basically if you go to the commander page and instead of dragging them off the ship to the side bar (like all the leader pages) you need to click on the hero until these icons show up....
They are hard to see as they popup UNDER the tooltip... so it is really easy to miss them and sometimes they do not show up.. I think you need to actual click on the portrait in the middle, as in on their actual face or something. Just click all over the place until they popup.
Anyway the 3rd Icon is FIRE. Clicking this will send the hero to the left available panel, and destroy the ship. You can now put a hero back in the ship to spawn it at your home system.
There is an exploit here. (as long as you are happy to clear all the XP on the ship).. as you can basically always teleport your commander ships home by doing this and then putting them back in the same ship strait away. This will clear the ship xp and upgrades, but will port the ship back to base.