Contrary to belief, they do not bury their heads in the sand. Let’s look to Wikipedia for insight into why we think that they do.
This myth likely began with Pliny the Elder (AD 23–79), who wrote that ostriches “imagine, when they have thrust their head and neck into a bush, that the whole of their body is concealed.” This may have been a misunderstanding of their sticking their heads in the sand to swallow sand and pebbles, or, as National Geographic suggests, of the defensive behavior of lying low, so that they may appear from a distance to have their head buried.