When Joab saw that death was inevitable, he said to Benaiah, who was charged with the execution of the king's order: "Tell Solomon he cannot inflict two punishments upon me. If he expects to take my life, he must remove the curse pronounced by David against me and my descendants on account of the slaying of Abner. If not, he cannot put me to death." Solomon realized the justness of the plea. By executing Joab, he transferred David's curse to his own posterity: Rehoboam, his son, was afflicted with an issue; Uzziah suffered with leprosy; Asa had to lean on a staff when he walked; the pious Josiah fell by the sword of Pharaoh, and Jeconiah lived off charity. So the imprecations of David were accomplished on his own family instead of Joab's.
Kingdom of Joab of David
Legends of the Jews 5:17