It is neither a metal nor a nonmetal. Magnesium bromide, #"MgBr"_2"#, is an ionic compound containing the metal magnesium (Mg) and the nonmetal bromine (Br). #"MgBr"_2"# is the formula unit for the compound, which means that the subscripts give the lowest whole number ratio of magnesium and bromide ions in the compound, which is #"1Mg":"2Br"#. There are no molecules of #"MgBr"_2"#.
Ionic compounds are crystalline in nature, which is why we represent them as formula units instead of molecules. The following image is a representation of a portion of a sample of #"MgBr"_2"#.