2 Samuel 24:9
9 And Joab gave up the sum of the number of the people unto the king: and there were in Israel eight hundred thousand valiant men that drew the sword; and the men of Judah were five hundred thousand men.
1 Chronicles 21:5
5 And Joab gave the sum of the number of the people unto David. And all they of Israel were a thousand thousand and an hundred thousand men that drew sword: and Judah was four hundred threescore and ten thousand men that drew sword.
In the account in 2 Samuel, we are told that Israel had 800,000 soldiers, and Judah had 500,000.
However, in the account in 1 Chronicles, we are told that Israel had 1,100,000 soldiers, and that Judah had 470,000.
The additional 300,000 soldiers in Israel in Chronicles is due to the author of Chronicles including the standing army of each tribe in his tally.
In 1 Chronicles 27:1-15, we learn that each tribe had a captain which had a standing army of 24 thousand.
24,000 x 12 tribes = 288,000.
In addition, 12,000 horsemen were typically stationed at Jerusalem (2 Chronicles 1:14).
288,000 + 12,000 = 300,000.
So there's Israel settled. Now what about Judah?
The figure of 470,000 men in Judah from Chronicles also comes from the fact that the author of Chronicles does not include the standing army of 30,000 men that Judah had, which is mentioned in 2 Samuel 6:1-2.
Also note that at the time of this census, the kingdom had not yet been divided into a northern kingdom (Israel) and southern kingdom (Judah). That would happen after the death of David's son Solomon. However, the books of Samuel and Chronicles are written when this division had occurred, and so the kingdoms are sometimes retroactively separated in the account of the events for clarity's sake.
There is no contradiction. The solution is found, as is always the case in these alleged numerical discrepancies, in understanding that there are different ways of counting according to different perspectives.