He was arrested on Tuesday after the Brazilian military plane he was travelling in made a stopover in Seville in southwestern Spain on its way to Japan, said a spokeswoman for Spain's Guardia Civil police force.
“His suitcase contained only drugs,” she added.
A court ordered Wednesday that the man, who is reported to be 38 years-old and a member of the Brazilian air force, be held in preventative detention on the charge of drug trafficking.
Bolsonaro, who has promised a tough stance on gangs which profit from drug trafficking, confirmed the arrest on Twitter on Tuesday, saying he had ordered Brazil's defence ministry to cooperate with Spanish police.
“If the soldier is found to have committed a crime, he will be tried and convicted according to the law,” he added.
The summit of the Group of 20 major economies, the so-called G20, will take place on Friday and Saturday in Osaka in western Japan.