In this sentence, "astray" describes the hikers' state of being lost and off course, functioning as an adjective.