Hit "ESC" key to find a screen for some options.
You may choose to "return to base" whenever you want, but dependent on the mods you play, you'll get some renown for sailing back to your homeport. (i.e. Stock 1.4b)
Within ~ 30 km radius around your base the option "return to base" changes to "dock to <homeport>".