  We describe the quantization of a four-dimensional locally non-geometric
M-theory background dual to a twisted three-torus by deriving a phase space
star product for deformation quantization of quasi-Poisson brackets related to
the nonassociative algebra of octonions. The construction is based on a choice
of $G_2$-structure which defines a nonassociative deformation of the addition
law on the seven-dimensional vector space of Fourier momenta. We demonstrate
explicitly that this star product reduces to that of the three-dimensional
parabolic constant $R$-flux model in the contraction of M-theory to string
theory, and use it to derive quantum phase space uncertainty relations as well
as triproducts for the nonassociative geometry of the four-dimensional
configuration space. By extending the $G_2$-structure to a $Spin(7)$-structure,
we propose a 3-algebra structure on the full eight-dimensional M2-brane phase
space which reduces to the quasi-Poisson algebra after imposing a particular
gauge constraint, and whose deformation quantisation simultaneously encompasses
both the phase space star products and the configuration space triproducts. We
demonstrate how these structures naturally fit in with previous occurences of
3-algebras in M-theory.
