"It does us no harm" is grammatical. Both do one harm and do one good are used in English as idiomatic expressions.

There are a number of expressions in English where a "dative" or "indirect object" is not required to be marked with the preposition "to". A common example is sentences with the verb give, as in "They gave us our presents". "It does us no harm" has the same syntax.

This may be called "dative alternation" or "dative shift". As other answers have mentioned, the usual word order when "to" is used would be "It does no harm to us", not "It does to us no harm". But for this expression, using "to" is not as idiomatic.