I believe that you are talking about the dream that Robinson Crusoe has in Chapter IX. This is a dream that really begins his religious conversion.

In this dream, Crusoe sees a man descending from the heavens to the Earth. The man comes towards Crusoe, holding a weapon in his hand. He tells Crusoe that he is going to kill him because all of these things that have happened to Crusoe have not been enough to make him repent and turn to God.

The dream inspires Crusoe to pray -- he says it is his first real prayer ever.