Have a look at: http://www.swi-prolog.org/FAQ/AllOutput.html
The simple solution is to type w after the answer is given, i.e.:
?- n_queens_problem(10,X).
X = [1, 3, 6, 8, 10, 5, 9, 2, 4|...] [write]
X = [1, 3, 6, 8, 10, 5, 9, 2, 4, 7]
After you have pressed the “w”-key “[write]” is displayed at the end and the full solution appears in the next line.