Speak out of turn

To say something unwise, to say something at the wrong time.

The young man spoke out of turn while the teacher was asking him questions.