The funeral of the murdered army commander Abner transforms into a powerful public display of mourning. Through this event, David seeks to deliver a clear moral message to the nation. He commands Joab and the people to tear their clothes, wear sackcloth, and conduct a public mourning [ביאור שטיינזלץ]. The primary approach among commentators is that the order specifically directed at Joab—who was the actual murderer—was intended to force him to show remorse for his actions. By doing this, David makes it completely clear to everyone that the killing was an unlawful act.
Taking his message a step further, King David personally escorts Abner to his burial to pay his final respects [ביאור שטיינזלץ]. The primary approach among commentators notes that this action is highly unusual. According to Jewish law, a king does not walk behind a funeral bier; even for a close relative, a king is not permitted to leave the doors of his palace. Yet, David willingly breaks strict royal protocol. His goal is to remove any trace of suspicion from the hearts of the Israelites, proving publicly that the murder was not carried out under his advice or command [רד״ק, אברבנאל, מצודת דוד, מלבי״ם].
To further strengthen his credibility, David takes one additional step. Traditionally, women walked behind the funeral bier. To appease the people, David leaves the company of men and chooses to walk among the women. For a deeply pious man like David, walking among women proves beyond any doubt that his grief is genuine. Only in a state of deep sorrow and true mourning, where there is absolutely no room for sinful thoughts, would he ever allow himself to behave in such a manner [מלבי״ם].