Let $p$ be an odd prime. We construct a $p$-group $P$ of nilpotency class two, rank seven and exponent $p$, such that $\text{Aut}(P)$ induces $N_{\text{GL}(7,p)}(G_{2}(p))=Z(\text{GL}(7,p))G_{2}(p)$ on the Frattini quotient $P/\unicode[STIX]{x1D6F7}(P)$. The constructed group $P$ is the smallest $p$-group with these properties, having order $p^{14}$, and when $p=3$ our construction gives two nonisomorphic $p$-groups. To show that $P$ satisfies the specified properties, we study the action of $G_{2}(q)$ on the octonion algebra over $\mathbb{F}_{q}$, for each power $q$ of $p$, and explore the reducibility of the exterior square of each irreducible seven-dimensional $\mathbb{F}_{q}[G_{2}(q)]$-module.