They are both OK, but I prefer #1.
In sentence 2, "to me" is a prepositional phrase, not an object.
1. He replied to my letter.
2. He replied to me.
I wonder if 'reply' can take a person as an object like sentence 2.
They're both fine. The first is only appropriate if you wrote him a letter in the first place. The second could refer to letters, emails, phone calls, text messages etc.
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.