Not from the accommodation arrangements on ships to India as is commonly claimed.
The story goes that the more well-to-do passengers on ships travelling
between England and India used to have POSH written against their
bookings, standing for 'Port Out, Starboard Home' (indicating the more
desirable cabins, on the shady side of the ship). Unfortunately, this
story did not make its appearance until the 1930s, by which time the
term had already been in use for some twenty years. Added to this, the
word does not appear to have been recorded in the form 'P.O.S.H.', which
would be expected if it had started life as an abbreviation. (Source)
A more likely source is the 1890s slang word for a dandy, but there is no agreement about origin.