This seemingly simple phrase that Hamlet utters after his horrifying meeting with his father’s ghost is actually another example of Shakespeare’s genius with words. Let’s begin by unpacking the basic meaning of the phrase itself. “The time” would refer to all current events that Denmark is encountering -- domestic, commercial, political, and international. For the phrase “out of joint,” imagine a dislocated shoulder. A joint in the wrong position is extremely painful and needs to be corrected immediately, or permanent damage will result, which could be crippling to the whole body. Anything described as "out of joint" is functioning incorrectly somehow, and requires fixing.
We can look at what this phrase might mean in the context of Hamlet’s situation. He feels he cannot tell the guards or Horatio exactly what the Ghost has revealed to him, but he wants them to know the kingdom is “out of joint,” meaning it is in peril. The Danish people believe that with the late King Hamlet’s brother Claudius on the throne, all is well in Denmark. In truth, there has been a major political upheaval of the throne, which is now in the hands of a murderer. Also, the domestic joining of Hamlet’s queen-mother to her former brother-in-law is rather incestuous. While somewhat accepted for political purposes during the late middle ages (the time period in which Hamlet is set), it was still religiously frowned upon.
Additionally, the guards and Horatio are already aware that something is amiss internationally, as they have been discussing the rumors about why Denmark is frantically preparing for war. The appearance of the ghost confirms in their superstitious minds that “something is rotten in the state of Denmark” (Marcellus, Act I, Scene 4). Their new king is already clearly doing a disjointed job of running the kingdom if he hasn’t even informed his guards about the threats of Norway’s Prince Fortinbras to reclaim his kingdom’s land.
With the ghost’s revelation that he was murdered by Claudius, Hamlet becomes horrifyingly aware of just how “out of joint” the whole kingdom is. This is so painful for him to hear that he laments, “Oh cursed spite / That ever I was born to set it right!” (Act I, Scene 5). He has little choice, however, for if he doesn't put the political joint back in place, it will indeed be crippling to the whole kingdom. Sadly in the end, it seems the only way to heal the kingdom is to wipe out the entire royal family--replace the joint, if you will--and allow Denmark to be ruled by the much better-hinged Fortinbras.