The following works fine for me, although with a different answer:
Clear[x];
p = Pi/(2 Sqrt[2]);
dgl = \[Theta]''[x] - p^2 Sin[2 \[Theta][x]] == 0;
sol = NDSolve[{dgl, \[Theta][0] == Pi/2, \[Theta]'[0] ==
0}, \[Theta], {x, 0, 1}]
entry = \[Theta][1] /. sol[[1]]
I cannot reproduce the error you get, but it is similar to what we happens when the independent variable of a differential equation is given a value before NDSolve
is called:
x = 0;
NDSolve[{f'[x] == 1, f[0] == 0}, f, {x, 0, 1}]
The variables f, x are not automatically protected from outside interference. However, in your case there must be something else going on.