(1). If $1\ne x\equiv 1 \pmod p,$ let $x=1+py.$ Then by the Binomial Theorem, $$x^a-1=(1+py)^a-1=\left(1+\binom {a}{1}py+...\right)-1=apy +(py)^2z$$ where $z$ is an integer . So $$\frac {1}{p} \frac {x^a-1}{x-1}=\frac {1}{p} \frac {apy +(py)^2z}{py}=\frac {a}{p}+yz.$$ This is an integer iff $p|a.$ If $a$ and $p$ are prime, $p|a\implies p=a.$
(2A). For prime $p$ and $p\not | x,$ let $ord_p(x)$ be the least $n>0$ such that $x^n\equiv 1 \pmod p.$ Then for $m>0$ we have $$x^m\equiv 1 \pmod p\implies ord_p (x)|m.$$ Proof: There are positive integers $A, B$ with $$A\cdot ord_p(x)-Bm=\gcd (ord_p(x),m).$$ Therefore $$1\equiv x^{A\cdot ord_p(x)}\equiv x^{Bm}x^{\gcd (ord_p(x),m)}\equiv x^{\gcd (ord_p(x),m)} \pmod p.$$ So by the def'n of $ord_p(x)$ we must have $\gcd (ord_p(x),m)\geq ord_p (x).$ But $\gcd (ord_p (x),m)$ cannot be greater than $ ord_p (x).$ So $ord_p (x)=\gcd (ord_p (x),m),$ which is equivalent to $ord_p(x)|m.$
(2B). From (2A) and Fermat's Little Theorem , we have: If $p,a$ are primes and $x\not \equiv 1 \pmod p$ then $$x^a\equiv 1\pmod p\implies (a=ord_p(x)\land a|(p-1).)$$ Because $ord_p(x)>1,$ and (2A) implies $ord_p(x)|a,$ so $ord_p(x)=a.$ Then by Fermat we have $a=ord_p(x)|(p-1).$
(3). We use (2B) to handle your Q for the case $x\not \equiv 1 \mod p.$
(i). If $p|x$ then $p\not | \;(x^a-1)$ so this case is moot.
(ii). If $0\not \equiv x\not \equiv 1 \pmod p$ then $$p|(x^a-1)/(x-1)\implies p|(x^a-1)$$ with prime $a,$ so by (2B), $a|(p-1).$ That is, $p\equiv 1 \pmod a. $
Remark: The results of (2A) and (2B) are commonly used tools.