Is the word replacement in my question is uncountable? But how?
You actually can use the word "an" before "ankle replacement surgery", with the meaning "a surgery to replace an ankle". In the example sentence, "an", "the", or no article at all could be used. The meanings would be the same, with differences in perspective:
"After ankle replacement surgery, the pain was gone." refers to the surgery as an uncountable type.
"After an ankle replacement surgery, the pain was gone." refers to a complete operation of that type.
"After the ankle replacement surgery, the pain was gone." refers to the particular instance of surgery.
Some examples where "an" or zero article might be preferred:
Use with "an": You are an orthopedic surgeon telling someone about your day. You could say "I have an ankle replacement surgery, and then some post-surgical visits to do today."
Use with zero article: In a general statement: "After ankle replacement surgery, pain is usually relieved."