All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Your prayer is valid and it is not invalidated by turning your head to the right side, as long as you did not totally turn away from the Qiblah with your chest.
The jurists stated that "if the praying person turns in prayer without turning his chest, then this does not harm."
You are not required to prostrate for forgetfulness for this turning.
An-Nawawi said while listing what does not require the prostration for forgetfulness:
"Turning, making one step, or two steps according to the most correct view, one hit [like hitting a fly for example] or two hits, sitting in a squatting position, putting the hand on the mouth or on the hip, thinking during the prayer, looking at something that distracts, looking up to the sky, rolling up the garment or the hair, wiping the gravel, yawning, uselessly touching one’s beard or nose, and other similar movements; one is not required to prostrate for doing any of them, whether he did that (move) deliberately or out of forgetfulness." [End of quote]
Allah knows best.