Literally, in the same tent (Latin contubernalis is from com-, together/with + taberna, tent/hut). This was originally applied to the "marriage" of slaves, as opposed to free persons who got to be connubial (formally married), but along the way was expanded to messmates or tentmates in the army and the like. I don't know when exactly it was borrowed from Latin, but I see citations ranging from Chaucer to Patrick O'Brian, so it's got a long history. For an example, let's go with that O'Brian, shall we? From The Nutmeg of Consolation:
"Another misery of human life," remarked Stephen to the morning darkness, "is having a contubernal that snores like ten."
Admin Note: I will be making a backup of this community on DreamWidth. Once this is completed, we should as a comm consider whether we want to move there for active posting. I'll start that discussion in a few days, after the backup.