Large scale computer simulations (those involving explicit consideration of a large number of atoms and/or very long simulation times) are needed in order to get a proper understanding of many material properties (phase transitions, transport properties, etc.). Given the computational cost associated with ab initio electronic structure codes, computational materials science and geoscience would greatly benefit from the availability of transferable, parameterized interatomic potentials. In this work, and taking MgO as test material, we show that fully transferable potential models may indeed be generated, by combining a physically motivated analytical form for the potential with an ab initio force-matching procedure to obtain the potential parameters. The potential is based on an ionic model of interactions, and incorporates many-body effects, to reflect the high sensitivity of the charge distribution of the oxide anion (and related properties, such as ionic polarizabilities, etc.) to the coordination environment. It is shown to describe accurately the atomic interactions in arbitrary coordination environments, so long as interionic electron transfer may be neglected. Close agreement with ab initio results is demonstrated for MgO in the bulk to extreme pressure, at point and extended bulk defects, and at planar surfaces and the corners and edges of clusters.