Click on the starbase/shipyard. Click on the little icon representing your ship. On the right of this small window that is in the bottom left there should now be listed Upgrade, Decommission, Eject Ship, and Details. Click Eject Ship. The ship should appear to the top left of the shipyard/starbase.