King Solomon had 4,000 stalls and in each stall there was one chariot and ten horses. This would have meant that Solomon could have had 40,000 stalls for horses and had 4,000 stalls for horses and chariots. “And Judah and Israel dwelt safely, every man under his vine and under his fig tree, from Dan even to Beersheba, all the days of Solomon. And Solomon had forty thousand stalls of horses for his chariots, and twelve thousand horsemen. And those officers provided victual for king Solomon, and for all that came unto king Solomon's table, every man in his month: they lacked nothing.” 1 Kings 4:25-27 “And they brought every man his present, vessels of silver, and vessels of gold, and raiment, harness, and spices, horses, and mules, a rate year by year. And Solomon had four thousand stalls for horses and chariots, and twelve thousand horsemen; whom he bestowed in the chariot cities, and with the king at Jerusalem. And he reigned over all the kings from the river even unto the land of the Philistines, and to the border of Egypt.” 2 Chronicles 9:24-26
These two verses do not contradict because they describe different types of stalls. The stalls in 1 Kings 4:26 were "of horses" which were used for chariots and by horsemen. Nothing in this verse says that these stalls were for the chariots. On the other hand, the stalls in 2 Chronicles 9:25 were for "horses and chariots" Such a stall to house both horses and chariots would not have been as numerous as stalls to house just horses because there is always a smaller ratio of chariots to horses.
“Then Solomon came from his journey to the high place that was at Gibeon to Jerusalem, from before the tabernacle of the congregation, and reigned over Israel. And Solomon gathered chariots and horsemen: and he had a thousand and four hundred chariots, and twelve thousand horsemen, which he placed in the chariot cities, and with the king at Jerusalem.” 2 Chronicles 1:13-14 There would be less of these stalls that were capable of storing both horses and chariots.
The 2 Chronicles 9:25 account describes the purpose of the stalls (i.e. "stalls for...."), 1 Kings 4:26 describes the purpose of the horses (i.e. "horses for...."). In saying that the purpose of the horses was for Solomon's "chariots, and twelve thousand horsemen" (interpreting the "twelve thousand horsemen" as part of the conjunctive list belonging with "chariots"), 1 Kings 4:26 effectively links the horses to items of which we know the numbers. If these horses were for 1,400 chariots (2 Chronicles 1:14) and 12,000 horsemen, the number of horses would have been considerably large. Even with the conservative assumption of 2 horses per chariot and 1 horse per horseman, the number of horses needed for 1,400 chariots and 12,000 horsemen is 14,800 horses. If there were one horse on reserve (a spare) per every horse on duty, that would already be 29,600 horses. Hence, 40,000 stalls would have been a reasonable number to accommodate this many horses. In conclusion, there were 40,000 stalls that were for housing horses, and 4,000 stalls that were for storing horses and chariots. The two numbers could be harmonized if each of the 4,000 stalls with the space to house a chariot had 10 subdividing stalls for individual horses.