"They were three officers with the National Force who accidentally went into the Vila do Joao community. Their car was hit by drug traffickers' [gunfire]," a police officer told AFP on condition that he not be named.
The incident took place in one of the sprawling slums known as favelas in the Complexo da Mare area.
"One of the police was shot in the head and underwent surgery and is now under observation. Another officer was shot but not seriously hurt," a Justice Ministry statement said.
"This was a regrettable and cowardly attack," Justice Minister Alexandre de Moraes said in Rio.
"We are working on identifying the suspects. Two already have been identified."
The officers were among the 5000-strong federal reinforcements sent in to help police South America's first Olympics, which kicked off last Friday.
Brazilian authorities have deployed an unprecedented 85,000 soldiers and police to protect the event.
Police, which fall under military control in Brazil, are engaged in often brutal operations against drug traffickers who control swathes of Rio's favelas. Shootings are an everyday occurrence.