I shared a room with him.

Literal

I [topic-は] him [with-と] room [object-を] shared.

共有する ('to share, have in common') is a Sino-Japanese verb. と marks the co-sharer. Common in dorm, roommate, or cooperative-living contexts.