If animals don't have freewill, why are dogs rewarded for not having barked at Jewish people during the Exodus from Egypt? (Exodus 11 and Exodus 22)
Rabbi Shafier of The Shmuz asks this question in one of the pieces from Parshas Mishpatim.
The gist of his answer (although I'd recommend reading it directly, it's not too long of an article) is a two step answer: 1) all results come about from Hashem, even though a person puts intent into their actions, ultimately no results would come about from the actions if Hashem didn't will for the results to come about. 2) Nevertheless, Hashem set up the reward system to work in a way where a person gets rewarded for the good that comes about for their actions, even though the results were all from Hashem.
Tying that idea back to your question:
Through the animals a greater good was brought, and for that they deserve reward. Granted they didn’t intend it — they are animals — but through them came a good, and that is attributed to them. For that, they deserve reward.
Free will and reward are not related,
for example, The Moon was punished for complaining.
It is just that G-d Almighty is just.
Is someone deserves good he should get it.
For example parents (even those that exploit their children) deserve respect.
Fruit Trees deserve respect (they should not be destroyed)
Animals deserve respect (even from non-jews) and meat separated from them while they were alive should not be eaten