Ships have a maximum range, they cannot sail beyond that. The fleet's range is determined by the shortest-range ship in the fleet.
Range can be improved by upgrading the engine of ship types, but this will only affect new ships ordered after research is complete.
Now, you can rebase to friendly ports anywhere on the world and operate from there. So taking your Germany example again, if you get Japan into the Axis you can order your fleet to rebase to one of their ports, and then you can operate from there. But still, no further than the max range of the fleet.
Its one of the reasons late-war high level fleets are better than early game low level ones.