A slightly dated saying, for sex among mariners, where the sailors were all males, unlike today's modern Navy, which is coed. Reference to anal sex.
There are a large number of nautical references for anal sex, which tends to make one wonder about the less than modern Navies of the world.
Navy Style is another, still used, reference to two males engaging in anal intercourse.
On the other hand, Naval Manoeuvres is supposed to be a humorous slang term for a woman masturbating.
Cakes are an obvious reference to the buttocks, being two halves of a cake.