Some translations (e.g. NIV, NLT) change “40,000” to “4,000” in 1 Kings 4:26 due to a perceived scribal error. 2 Chronicles 9:25, which appears to be a parallel account, says “4,000”. Along with the KJV, the NKJV, NASB, ESV and HCSB uphold the inspired Hebrew text which says, “40,000”.
The two passages describe different types of stalls
1 Kings 4:26 says:
“Solomon had forty thousand stalls of horses for his chariots, and twelve thousand horsemen”.
2 Chronicles 9:25 says:
“Solomon had four thousand stalls for horses and chariots, and twelve thousand horsemen”.
The 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. In fact, 2 Chronicles 1:14 says there were 1,400 chariots. Hence it makes sense that there would be less of these stalls that were capable of storing both horses and chariots.
Whereas 2 Chronicles 9:25 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.