The sefer toras moshe al hatorah from the chassam sofer page 346 brings from the avudraham that even if asara bteves falls out on Shabbos u would have to fast. He explains the reason: because every yr on asara bteves the bes din shel ma’ala contemplates whether there will be a churban hamikdash that year or whether there will be a binyan bais hamikdash. Therefore, just like a person has to fast for a taanis chalom even on shabbos becuase it is a tzara that he wants to be mevatel, so too fasting on asara bteves is not a fast for a prior tzara but rather a fast to avoid any future tzaros. That is why we fast asara bteves even on shabbos and erev shabbos.