Brazilian President Jair Bolsonaro has temporarily left a prison in Brasilia for medical examinations after hitting his head.