1 Kings 2:31–33 (ESV)

31 The king replied to him, “Do as he has said, strike him down and bury him, and thus take away from me and from my father’s house the guilt for the blood that Joab shed without cause.

Solomon himself had no qualms about the correctness of carrying out the death sentence regardless of Joab’s location. Benaiah was told to strike Joab down where he was. Do as he says, is the king’s language. Even if Joab thought that his statement would save his life, or at least prolong it, Solomon treated it as Joab’s signature on his own death warrant.

Solomon also directed Benaiah to bury Joab. Burial was necessary on two counts. First, the land should not continue to be polluted by the blood of the slain. Given the later statement of Solomon concerning the blood guilt that Joab had brought, this might have been the most important reason (Deuteronomy 19:10). Yet, second is the fact that it was a great dishonour for a corpse not to be buried. In the later histories of Israel and Judah, it was only the most wicked of people who were to be left without burial (1 Kings 1:23; 2 Kings 9:1–37).

Upon what did Solomon base the conclusion that Joab could be killed where he was? He based it on the serious nature of Joab’s murders. Because Joab’s murders had not been dealt with up to this point, the blood guilt for the deaths of Abner and Amasa had rested upon the whole nation, and this included the Davidic dynasty. With the execution of Joab, the guilt would rightly come to rest upon the head of Joab.