When I woke up, I was lying on the floor.

Literal

Eye [subject-が] wake-up-[and-see-てみる][when-と] I [topic-は] floor [at-に] was-lying.

床に here picks に over the alternative 床の上で. The difference is subtle but real: に marks the floor as the location of existence/state (the 'where' of lying), where で would mark it as the location of an active event. With 寝る read as a resultative ~ている state, either particle works, but に feels a shade more natural for 'lying in place' — the body settled, not actively going-to-sleep.