Recently, neutron stars with very strong surface magnetic fields have been suggested as the site for the origin of observed soft gamma repeaters (SGRs). We investigate the influence of a strong magnetic field on the properties and internal structure of such strongly magnetized neutron stars (magnetars). The presence of a sufficiently strong magnetic field changes the ratio of protons to neutrons as well as the neutron appearance density. We also study the pion production and pion condensation in a strong magnetic field. We discuss the pion condensation in the interior of magnetars as a possible source of SGRs.