Generally the virial theorem provides a relation between various components of energy integrated over a system. This helps us to understand the underlying equilibrium. Based on the virial theorem we can estimate, for example, the maximum allowed magnetic field in a star. Recent studies have proposed the existence of highly magnetized white dwarfs, with masses significantly higher than the Chandrasekhar limit. Surface magnetic fields of such white dwarfs could be more than 10^9 G with the central magnitude several orders higher. These white dwarfs could be significantly smaller in size than their ordinary counterparts (with surface fields restricted to about 10^9 G). In this paper we reformulate the virial theorem for non-rotating, highly magnetized white dwarfs (B-WDs) in which, unlike in previous formulations, the contribution of the magnetic pressure to the magnetohydrostatic balance cannot be neglected. Along with the new equation of magnetohydrostatic equilibrium, we approach the problem by invoking magnetic flux conservation and by varying the internal magnetic field with the matter density as a power law. Either of these choices are supported by previous independent work and neither violates any important physics. They are useful while there is no prior knowledge of field profile within a white dwarf. We then compute the modified gravitational, thermal and magnetic energies and examine how the magnetic pressure influences the properties of such white dwarfs. Based on our results we predict important properties of these B-WDs, which turn out to be independent of our chosen field profiles.