In these passages is the account of Sheba leading 10 tribes of Israel away from David. These tribes were willing to depart and follow Sheba because they were at odds with Judah.
Judah was more aligned with King David because David ruled Judah for seven years before ruling all of Israel. David was from the tribe of Judah.
Joab, David’s army commander, pursued Sheba and besieged the city where Sheba was staying. The people of the city knew their city would be destroyed, so they killed Sheba and gave Sheba’s head to Joab. The conflict ceased.
David once again ruled all 12 tribes in Israel. However, this natural divide between Judah and Israel continued. Eventually, Israel would break away from Judah and they would become two separate nations. This would happen after the death of King Solomon, David’s son.