The spellcasting AI will avoid using gems if the opposing army is not deemed to be enough of a threat. This is to avoid wasting gems for that type of spells when attacked by a single scout or similar throwaway chaff.

There are various threads on this subject, but you are better off asking in the Dominions 3 forum, since it is active, unlike this one. This issue is the same for both Dom2 and Dom3.