An electromagnetic wave doesn't violate the conservation of energy. Maxwell's electromagnetism does. When you apply the Maxwell's equations to two beams of light of the same frecuency, collinear, out of phase 180 degree, occurs the phenomenon of destructive interference. In this special case the electric field of one wave is cancelled with the electric field of the other wave; the same happens with the magnetic fields. Both fields become zero. Following Maxwell the energy is contained only in those fields.
Let make the math: Let us have these two waves: Be E = electric fiel; B=magnetic field
E1 = Em sin (kx - wt) E2 = Em sin (kx - wt + p) B1 = Bm sin (kx - wt) B2 = Bm sin (kx - wt + p)
E = E1 + E2 and B = B1 + B2
E = Em sin (kx - wt) + Em sin (kx - wt + p)
B =Bm sin (kx - wt) + Bm sin (kx - wt + p)
But, sin (kx - wt + p) = - sin (kx – wt) ,
Then, E = 0 and B = 0 and,
UT = UE + UB
UT = ½ eOE2 + ½mOB2
UT = 0
According to Maxwell equations, in destructive interference of two collinear beams out of phase 180 degree, the energy density, which is a function of the electric and magnetic fields, is destroyed too. In this way, the principle of conservation of energy is violated.