This has been used since the 15th century to mean maddened/out of one's senses. A similar phrase in French: 'hors de soi' - literally 'out of oneself' - means just the same thing. The idea is that you and your mind are somehow 'adrift' from each other, as it were. It's not a lot different - in the 'position sense - from being 'in two minds' about something.