In quantum many-body systems with local interactions, the effects of boundary conditions are considered to be negligible, at least for sufficiently large systems. Here we show an example of the opposite. We consider a spin chain with two competing interactions, set on a ring with an odd number of sites. When only the dominant interaction is antiferromagnetic, and thus induces topological frustration, the standard antiferromagnetic order (expressed by the magnetization) is destroyed. When also the second interaction turns from ferro to antiferro, an antiferromagnetic order characterized by a site-dependent magnetization which varies in space with an incommensurate pattern, emerges. This modulation results from a ground state degeneracy, which allows to break the translational invariance. The transition between the two cases is signaled by a discontinuity in the first derivative of the ground state energy and represents a quantum phase transition induced by a special choice of boundary conditions.