At one time you could be given the choice of going to prison or joining the army for minor offences, but that was the army, not the navy (and I'm not sure if that was just in movies or possible the Soviet Union).
And if you go back further: just been in port at the wrong time, could involve you suddenly finding yourself in the navy.
Sorry these facts probable don't help with your present situation though.
Good Luck with fixing it and that it works out for you.