In this chapter, Rehoboam establishes his reign in Judah by fortifying towns and placing his sons in command.
The first part of this chapter is copied from 1 Kings 12:21-24, but the rest of it is unique to Chronicles. Additionally, there are long sections from Kings that are omitted in Chronicles, particularly as it relates to Jeroboam and the northern kingdom. The stories left out are pretty significant since they explain how the northern kingdom fell into idolatry. We see a hint of that in verses 13-15 which explains some of the results of Jeroboam's actions (in particular, the Levites and priests flee to Jerusalem when Jeroboam appoints other men as his priests). As I discussed in the introduction to 2 Chronicles, this book is heavily focused on the history of Judah so that's probably why the section about Jeroboam is left out.
The more important question is why did the Chronicler want to include this new section (verses 5-23). What role does this serve in the narrative?
It's hard to say for sure, but my best guess is that this chapter is meant to show the relatively strong position of Rehoboam even after the split. After the LORD prohibits the men of Judah from retaking the northern kingdom by force, Rehoboam reinforces his position through several means. First, he builds out the fortified towns around his border, placing loyal commanders and equipment in them. Second, we see Levites and priests along with other people flowing from the north into the south in order to worship the LORD before the temple. This has the immediate effect of strengthening Rehoboam (v. 17), but it also has a longer term effect of prolonging Judah's slide into idolatry, much more so than what we will see in the northern kingdom whose very first king builds two idols in Bethel and Dan (this is barely mentioned in Chronicles but discussed at length in 1 Kings 12-13).
Third, we see Rehoboam having many children through many wives, which is typically a symbol of great influence or power (for instance, both David and Solomon are recorded as having many wives and children). Fourth, we see Rehoboam place his sons in various places around the kingdom, presumably to act as administrators and leaders in the different parts of Judah. Similar to placing his own commanders in the fortified towns, placing his sons throughout the kingdom will likely strengthen Rehoboam's reign due to their implied loyalty to him. My NIV commentary also suggests that Rehoboam may have put his sons elsewhere to keep them out of the royal court in Jerusalem, to keep them out of the way of Abijah.
It's an interesting parallel that Solomon was not David's oldest son, nor is Abijah the oldest son of Rehoboam, yet both of them were made king. In David's case, two of his oldest sons rebelled against him (Adonijah and Absalom), and it's possible that Rehoboam's sons may have also wished to rebel when the kingdom was given to Abijah. Rehoboam undercut that prospect by sending many of his other sons away from Jerusalem, so that they would have fewer connections to important royal officials. For example, when Adonijah tried to usurp the throne he first won the support of important officials in 1 Kings 1:7. By sending his other sons out of Jerusalem, this kind of betrayal would be much harder to organize. As a result, we have no evidence that his sons ever turned on Rehoboam or that there was any major rebellion against him.
In conclusion, Rehoboam is well-guarded against internal threats to his reign or his successor, but in the next chapter we will see that his preparations are not enough to protect him from the external threat of the Egyptian king Shishak.