It is generally advised against repotting a cactus while it has buds or flowers on it. My Mammillaria prolifera has just finished flowering and it really needs repotting but since it's a self-fertile species, I am expecting to have some berries in the beginning of autumn. How likely is my repotting to make my cactus abort its coming fruits? Since it's a rather widespread cactus, I am hoping someone will have had first-hand experience with the issue.
A proper repotting job should not shock a cactus into abortion. I have never given fruiting a thought when repotting cacti, and I haven't noticed a decline in the plants' fruiting. Not M. prolifera, but several other species. I do like to wait until flowering is over, because the flower stem on many cacti is fragile, and I do not like losing them to breakage.
My repotting method on cacti does not necessarily remove all the current mix, but rather the outer layer where the roots were circling. If you usually completely clean the roots during repotting, this will shock the plant, and I would not be surprised to see energy directed away from the fruiting, into rebuilding the root system.
I saw you posted your result 7 months later:
For what it's worth, I had two specimens of M. prolifera, and the one I did end up repotting has shown no fruits as of today.
If the two cacti received comparable care other than the repotting, I would assume that the repotting did shock the specimen in question.