You've got the inference reversed. Rather any equation true in integers remains true modulo $\,m\,$ for any $\,m.\, $ Indeed, if two integers are equal, say $\, a= b\,$ then $\, a- b = 0 = 0\cdot m\,$ is a multiple of $\,m,\,$ thus $\, a\equiv b\pmod m,\, $ by the definition of congruence, viz. $\,m\mid a-b,\,$ i.e. $\,m\,$ divides $\,a-b.$
What makes this nontrivial is that congruences are equivalence relations that are compatible with addition and multiplication, so modular reduction preserves equality of arbitrary integer polynomial expressions, cf. the Polynomial Congruence Rule. For example, write an integer as a polynomial in radix $10,\,$ say $\, n = P(10).\,$ Then mod $9\,$ we have $\,\color{#c00}{10\equiv 1}\,$ so $\,P(\color{#c00}{10})\equiv P(\color{#c00}1)\equiv $ digit sum of $\,n,\,$ which yields a fast way to check decimal arithmetic by checking the calculation mod $9,\,$ so-called casting out nines.
This is used frequently, e.g. when we compare parity of expressions, i.e. their remianders mod $\,2,\,$ (e.g. in irrationality proofs of $\sqrt 2),\, $ and also when checking aritmetic by comparing their units digits, i.e. comparing remainders mod $10,\, $ or when casting out nines and elevens, etc.
More generally we can check arithmetic mod $\,n\,$ by checking it modulo divisors $\,m\,$ of $\,n.\,$ (Above is the special case $\,n =0,\,$ since the integers mod $0$ is just the integers). If you do enough modular checks these necessary conditions are even sufficient, e.g. see the Chinese Remainder Theorem.