How? You can not get banned for using something that isn't banned... If you were using it while it was unregulated you cannot get retroactively banned if it is regulated by new rules at a later time. Thats preposterous.
But what if a substance or its chemical byproducts remains in your system? Would tests always be able to reveal they were administered before the new rules became active?
And if it were possible for surgery to create an unfair advantage, and that surgery had long term consequences, couldn't that apply to the athlete's ability to compete after the new rule took effect?
I don't know whether the following Wikipedia article is correct
https://en.wikipedia.org/wiki/Oscar_Pistorius
but if it is, the IAFF temporally revoked Oscar_Pistorius's ability to compete with specific prosthetic limbs that they thought gave him an unfair advantage over non-disabled athletes. That is somewhat close to that.
Likewise
https://www.sports.legal/2020/11/3708/
appears to be another example of something similar in which Blake Leeper's prosthetic limbs were banned.
I guess that didn't completely ban them - they could have used other prosthetic limbs. But suppose something were surgically implanted - e.g., some type of synthetic muscles, that was initially allowed, but later banned?
There have been some athletic "enhancement surgeries" that might create advantage, now or in the future, discussed at
https://www.gymnica.upol.cz/pdfs/gym/2006/02/06.pdf
Obviously that is an outdated article. But it is easy to imagine the athletes that have had enhancement surgeries being banned in future, even if they aren't at the time of the surgery.
Corrective vision surgery is one such possible case - sometimes it creates vision that is better than the average person has. While this is no longer true, my own vision after Lasik+PRK was better in one eye (or with both eyes together), after surgery - though, if I recall correctly, I had to wear glasses to get the improved vision, because the surgery was somewhat imperfect - I think it was 20/15 or 20/10. I didn't compete, but there are cases of athletes who did and do compete after such surgery. In those sports where enhanced vision is an advantage (which I don't think includes figure skating, though it likely includes hockey, golf, archery and marksmanship, because being able to see subtle details at a distance is important for them; for the specific case of hockey, and perhaps other team sports which occur over an extended area, an enhanced field of view is also said to be an advantage), it is easy to imagine that being a specific case in which it could occur that athletes become banned because of surgery before the rules are established. (Note: immediately after surgery, it is much more common for patients to have problems with their vision, until their eyes heal. That was true for me too, in some respects for about a year. Definitely don't expect to drive home from vision surgery.)
I'm not certain that a brain implant could enhance mental acuity, such as memory, beyond normal human standards. But if it could - and such technologies are being worked on quite a bit, I could imagine the early adopters being banned after rules were established against that. My memory is imperfect, and I have a family history of Alzheimer's; I could easily imagine desiring that regardless of athletics. Memory could affect an athlete's ability to remember a figure skating program. It could also affect athletic auditions - e.g., I am aware of a case where the ability to remember a movement sequence was one of the criteria used to select members of a synchronized skating team. Which makes some sense, because large skating teams like that sometimes have to deal with competition day program changes, because one of the members is injured or is unable to get there. I also once watched a choreographer work with a group of skaters in a learn-to-skate program, who were preparing for a show. She casually assumed all the kids could remember a perhaps 5 or 10 move sequence she only performed for them once. That wasn't even competitive - perhaps she simply didn't realize some of the kids couldn't do that. (Not too surprising for a choreographer - performance dancers are expected to memorize much longer sequences with little lead time, and they too sometimes have to deal with performance day changes that occur when someone is injured or doesn't show up. But I didn't think she should have made that assumption with ordinary kids in a LTS program.) Even in ordinary team sports, team members are often expected to memorize somewhat complex "plays". I assume that is difficult for some of them.