High pressure is known to influence electronic structure and crystal packing, and can in some cases even induce compound formation between elements that do not bond under ambient conditions1, 2, 3. Here we present a computational study showing that high pressure fundamentally alters the reactivity of the light elements lithium (Li) and beryllium (Be), which are the first of the metals in the condensed state and immiscible under normal conditions4, 5. We identify four stoichiometric LixBe1-x compounds that are stable over a range of pressures, and find that the electronic density of states of one of them displays a remarkable step-like feature near the bottom of the valence band and then remains almost constant with increasing energy. These characteristics are typical of a quasi-two-dimensional electronic structure, the emergence of which in a three-dimensional environment is rather unexpected. We attribute this observation to large size differences between the ionic cores of Li and Be: as the density increases, the Li cores start to overlap and thereby expel valence electrons into quasi-two-dimensional layers characterized by delocalized free-particle-like states in the vicinity of Be ions.