One valuable takeaway from O'Henry's "After Twenty Years" is that the past always catches up to you. Bob lives a life of crime, and he thinks all his "hustling around" will never catch up to him. He is in the wrong place at the wrong time, so he is arrested. For keeping his appointment with Jimmy, Bob pays for his crimes. O'Henry seems to be cautioning against doing bad things, as they will always catch up in the end.
Another lesson we learn is not to underestimate anyone. Bob brags about his success and hopes "Jimmy has done half as well. He was kind of a plodder, though, good fellow as he was." Bob is saying that the Jimmy he knew was unambitious, yet he was a good person. He believes that his friend will keep the appointment because Jimmy is reliable, and "he always was the truest, stanchest old chap in the world." So, while Bob trusts Jimmy will come, he does not think Jimmy will have been successful in his life. He certainly never guesses that Jimmy has become a police officer who will have him arrested. The truth is, if Jimmy is so true and such a good person, the only thing he can do is turn in his old friend; Bob does not seem to know Jimmy so well.
Another valuable moral here is that doing the right thing must take precedence over everything else. The two friends keep their twenty-year appointment; that should say something about the value of friendship. However, once Jimmy recognizes that his old friend is a wanted criminal, he must make a choice. He writes to Bob, "Somehow I couldn't do it myself" because he feels guilty for betraying his old friend. It's an understandable feeling. But Jimmy knows the right thing to do is to arrest Bob, so he places the law before a friendship.