The story does not specifically explain when Jim sells his watch.
However, Della goes shopping for Jim's present during the day of Christmas Eve. She finds and buys the watch chain, which indicates that Jim was still the owner of the watch when he left for his work that morning - Della would not have bought the gift if Jim no longer had the watch. Therefore, Jim must have sold the watch sometime during the day of Christmas Eve, giving him the funds he needed to purchase the hair combs as a present for Della.
In O.Henry's 'The Gift of the Magi', Jim sells his watch when he has no other option to find money to buy a christmas gift to his wife, Della. He wants to please his wife by giving a present, but his salary is not enough for that. Therefore, at this occasion, he sells his valuable gold watch to get the needed money for a valuable gift for Della.