Just to add a little background...
Hamlet speaks these words upon hearing that the watch has seen the ghost of his father. He thinks that it is a sign that something is wrong. Although he does not know of the murder of his father by Claudius, the appearance of the ghost is seen as a sign of unrest.
The notion behind the statement "Foul deeds will rise though all the earth will overwhelm them" is that even though they are buried deep, the truth will emerge, and people will know of the dark deed. Elizabethans would have believed that the ghost is a sign of wrongdoing, and that it rises because justice needs to be served so that the spirit can rest.
My father's spirit in arms. All is not well.
I doubt some foul play. Would the night were come!
Till then sit still, my soul. Foul deeds will rise,
Though all the earth o'erwhelm them, to men's eyes.