Pedrosa was one of a group of people arrested after being surprised during the exam at the Universidad Politecnica de Valencia on Saturday, Spanish media reported.
A local government official said some students had been wired up with earpieces to receive the answers to the exams and that 21 people had been detained in the operation.
"After taking bad advice I have committed an error," the Honda rider said in a statement released through his lawyers.
"You can ignore or learn from mistakes and I have learned from this. I want to apologise to all my followers.
"Now I want to look forward. I am a motorbike rider, the world championship begins this weekend in Qatar and I want to focus exclusively on Sunday's race."
Pedrosa, 26, was world champion in the 125cc and 250cc categories but is still seeking his first title in MotoGP after six attempts. He finished fourth last year.