Although by Bible times people had moved out of the original cave dwellings that were abundant in the ancient Middle East, there were always people who lived in caves. Lot lived in a cave after his escape from Sodom (Gen 19:30), and the Edomites made and enlarged caves in the rock face at Petra for living and for public affairs.
Obadiah refers to the Edomites as those who dwell int he clefts of the rock, whose habitation is high (Obadiah 3). There were caves under the homes in Nazareth that were contemporary with Jesus, and traditionally (almost certainly) Jesus was born in a shepherd’s cave.
Caves were always in use for escape (Joshua 10:16; 1 Samuel 22:1; 1 Kings 18:4), and the Philistines taunted the Israelites for using holes in the ground to hide themselves. (1 Samuel 14:11).
By Bible times people were either living in settlements in a good defensive position with a water supply, or else they had adopted a semi-nomadic form of life, living in tents and moving with their herds from oasis to oasis, where crops could be grown.