In this paper, a two-dimensional (2D) numerical simulation has been performed for an unsteady magnetohydrodynamics (MHD) flow around a solid square cylinder placed in a channel. Computational simulations were done for the ranges of Reynolds and Stuart numbers of 1–250 and 0–10, respectively. Finite volume method (FVM) has been used to solve the unsteady Navier–Stokes equations. The effects of streamwise magnetic field on the flow separation and suppress of the vortex shedding are studied in detail for the above ranges. Additionally, four new empirical equations for wake length and Stuart number are suggested. Finally, a comparison is performed between the cases of with and without a channel to study the effect of channel walls. The obtained results revealed that Strouhal number decreases linearly with increasing Stuart number. Also, the flow distribution pattern changes from time-dependent pattern to steady-state by increasing Stuart number.