O. Henry was writing a Christmas story which would probably be published in the Christmas issue of his newspaper. The story contains many references to the Christmas story told in the New Testament. There is, of course, a big difference between Jim and Della Young and the three kings, or Magi, in the Bible. The Magi were very wealthy men and brought the baby Jesus valuable presents, including gold. Jim and Della are poor, but O. Henry twice maintains that they are, figuratively speaking, richer than the richest men and women in the Bible.
In the first instance, O. Henry compares Jim to King Solomon and Della to the Queen of Sheba, whose famous encounter is related in the Old Testament (1 Kings 10).
Had the Queen of Sheba lived in the flat across the airshaft, Della would have let her hair hang out the window some day to dry just to depreciate Her Majesty's jewels and gifts. Had King Solomon been the janitor, with all his treasures piled up in the basement, Jim would have pulled out his watch every time he passed, just to see him pluck at his beard from envy.
This is O. Henry's wildest hyperbole, but it serves to show how much Jim values his watch and how much Della values her hair. After Jim and Della realize they sacrificed their greatest treasures without being able to benefit each other, O. Henry expresses the moral of his Christmas story in similar hyperbole.
And here I have lamely related to you the uneventful chronicle of two foolish children in a flat who most unwisely sacrificed for each other the greatest treasures of their house. But in a last word to the wise of these days let it be said that of all who give gifts these two were the wisest. Of all who give and receive gifts, such as they are wisest. Everywhere they are wisest. They are the magi.
O. Henry, of course, is using poetic license. He does not mean that the Youngs are literally like the wealthy kings in the Christmas story, but rather that Jim and Della are in a sense richer than King Solomon, the Queen of Sheba, and the three Magi because they possess the most valuable thing in the world: their love for each other. Many readers must have recognized the truth in all this poetic hyperbole, because O. Henry's "The Gift of the Magi" is the most popular story he ever wrote.