A common pattern in Prolog is the use of helper predicates with an accumulator.
Xn is repeated multiplication. It's shorthand for 1 * X * X ..., repeated n times, correct? And that gives you the prolog predicate you need.
Try something like this:
% ---------------------------------------------------------
% pow/3 — Our public predicate to raise X to the Nth power,
% unifying the result with R
% ---------------------------------------------------------
pow( X , N , R ) :-
pow(X,N,1,R)
.
% --------------------------------------------------------------
% pow/4 — Our private helper predicate
%
% It also raised X to the Nth power, but uses an accumulator, T,
% in which to accumulate the result.
% --------------------------------------------------------------
pow( _ , 0 , R , R ) . % Once we hit the 0th power, we're done: just unify the accumulator with R.
pow( X , N , T , R ) :- % To evaluate X to the Nth power...
N > 0, % 0. For non-negative, integral values of N.
T1 is T * X, % 1. Multiple the accumulator by X
N1 is N-1, % 2. Decrement the power N by 1
pow(X,N1,T1,R) % 3. Recursively evaluate X to the N-1th power
. % Easy!