hi welcome to HealthMagic forum
you have not mentioned your age it is not undersyood the reason for physical exam ,that too examinations of testes and prostate
is it for some medical examination for some service
a doctor will not mind any arousal on your part during examination. as a professional a doctor knows that this thing can happen and doctor is prepared for it
there is nothing to be worried about it .
it only will confirm that you are a normal man with normal sexual development
may be that you may need some control over your mind
wish you healthy life