Answer: He was worshiping Allah in the Cave of Hirā’,
and the revelation descended upon him while he was in the cave in that state.