You've said that the meaning of くみす is contrary to you understanding of the word 天道, but you haven't said what you believe 天道 means. This term (pronounced てんどう or sometimes てんとう) can actually have a wide range of meanings and connotations depending on the context, but here we are dealing with a quotation from 『史記抄{しきしょう}』, a 15th-century Japanese commentary on the Chinese classic 『史記』 (Shi Ji, or Records of the Great Historian). Thus, the relevant context is the body of East Asian philosophical and political thought that originated in China and is broadly termed "Confucianism"*** in English. (See note below.) In such a context, 天道 is usually translated as "Heaven," and it refers to the force or set of principles that governs the workings of the universe, including the affairs of humankind. "Confucian" thinkers sometimes portrayed this force as abstract and impersonal (rather like the laws of physics), but in other cases they treated it as something akin to a deity.
With that in mind, let's look at the full sentence from which this short fragment has been excerpted. As another respondent has noted, that sentence reads as follows:
守道者ハ、天道{てんだう}ハクミシモセヨ、クミセイデモアレ、各々{おのおの}吾{わ}ガ志{こころざし}ニ従{したがひ}テ守道マデヨ
The topic of this sentence is 守道者. As modern readers, we're likely to read that as しゅどうしゃ, but since we are dealing with a text by a 15th-century Rinzai monk, it's possible that it's intended as a bit of embedded Chinese or kanbun -- in other words, we could read it as ダウをまもるもの or possibly even みちをまもるもの. Either way, it means "those who follow the Way," where "the Way" refers to the moral, ethical, and ritual standards that guide (or ought to guide) human behavior. So 守道者 are those who strive to uphold those standards, and in particular, rulers who seek to apply them to political governance. So the topic of our sentence is "those who follow the Way," with the understanding that this refers primarily to righteous rulers who seek to implement the teachings of what Westerners call "Confucianism."
Now let's look at the predicate. I'd argue that in this case the embedded kanbun reading of 守道 is probably preferable, since it supplies us with a necessary verb, so we have:
各々{おのおの}吾{わ}ガ志{こころざし}ニ従{したがひ}テ守道{ダウをまもる}マデヨ
This is quite straightforward: 各々 means each; 吾が means "one's own"; 志 means "aim, intention, aspiration, etc.," and especially, in premodern religious and philosophical texts, "the aspiration to behave morally and ethically"; ニ従テ means "according to" or "in accordance with"; 守道{ダウをまもる} means "follow the Way"; and マデ and ヨ are both sentence-final emphatic particles.
So if we put the subject and the predicate together, ignoring that middle clause for the moment, that gives us
"Those who follow the Way […] all follow it in accordance with their own individual aspirations."
Now, what about that middle clause -- the one you asked about?
天道{てんだう}ハクミシモセヨ、クミセイデモアレ
The key point is that although this clause contains two instances of the 命令形{めいれいけい} (せよ and あれ) and therefore looks like it could be an imperative, it is actually a "whether x or not x" clause. I'm sure this site contains much better explanations of this usage of the 命令形 than I could provide, so I'll limit myself to noting that in medieval Japanese, such clauses used the phrase 〜もせよ where modern Japanese would use 〜にせよ or 〜にしろ, and that the word preceding 〜もせよ functions as a direct object of せよ. (That's why the 連用形 of くみす is used here, rather than the 終止形 we would expect with 〜にせよ or 〜にしろ in modern Japanese.) It's also important to note that the particle following 天道 here is は, not に. This marks 天道 as the subject and not the object of くみす, which as you have already noted basically means "to ally oneself with [someone or something]."
So in light of the above, we can translate 天道ハクミシモセヨ、クミセイデモアレ as "whether Heaven allies itself with them or not" or "whether Heaven favors them or not." (The former option is more faithful to the literal meaning of the original and highlights the fact that in this particular instance, Heaven seems to be understood as an active agent rather than an impersonal principle; the latter option is more ambiguous on the question of agency, but arguably a bit more idiomatic in English.)
A clumsy, overly literal, phrase-by-phrase translation of the whole sentence would be something like
As for those who follow the Way, whether Heaven allies itself with them or not, they all follow the Way in accordance with their own individual intentions.
And a more idiomatic way of saying this in English, while also fleshing out some of the implied connotations, would be
Those who follow the Way follow it in accordance with their own individual aspirations [to perfect themselves morally and be just rulers], and they [continue to] do so whether Heaven favors them or not.
In other words, a righteous ruler doesn't conceive of following the Way as a kind of "deal" he makes with Heaven, in exchange for which he expects to receive good fortune as a kind of reward. And conversely, he doesn't abandon the ideal of following the Way if things go badly for him. Rather, he recognizes that ethical rulership is a worthy end in its own right, and he pursues that goal whether he experiences good fortune or not.
When we consider the historical context in which『史記抄』was produced, and the fact its original intended readers would have been warlords who ruled in a time of constant turmoil, this seems like a sound and necessary caveat. Classic “Confucian” political theory held that if a ruler followed the Way, Heaven would in fact reward him with its favor, with very concrete results: His realm would be prosperous and at peace, he would easily vanquish any enemy foolish enough to attack him, and even the natural world would support him (the weather would be mild and favorable for agriculture, there would be no earthquakes or other natural disasters, etc.) He would also enjoy the enthusiastic and grateful support of his subjects, and he and his descendants would remain in power for as long as they continued to follow the Way.
In practice, of course, there was no guarantee that even the most conscientious ruler would really enjoy all these benefits, particularly under the conditions of continual warfare that obtained in late medieval Japan. The author of 『史記抄』was well aware of this reality, and he was doubtless also aware that many warlords tended to behave in precisely the way he is saying they shouldn't, jettisoning ethical principles in favor of harsh repression whenever they felt their hold on power was in jeopardy.
***The term "Confucianism" is problematic, and some Japanese readers may even find it confusing, as it is meant to encompass a vast corpus of material not directly associated with the historical personage westerners call "Confucius." 儒学{じゅがく} is probably the closest Japanese equivalent to the way that "Confucianism" is used in English-language literature on East Asian thought.