Human rights activists say the men executed were Ahmed al-Malali and Ali al-Arab.
Bahrain executed two Shiite citizens on terror charges, officials said, despite appeals for clemency from international human rights groups.
The pair, identified by rights groups as Ali al-Arab, 25, and Ahmad al-Malali, 24, were put to death by firing squad, the prosecutor said.
Both defendants were Shiite, judicial sources said, without confirming their names.
The small Gulf state, a key US ally located between regional rivals Saudi Arabia and Iran, has been gripped by bouts of unrest since 2011, when authorities cracked down on Shiite-led protests demanding political reform.
The two men, arrested separately in February 2017, were both sentenced to death in January last year after a mass trial with 58 other defendants that was marred by allegations of torture.
The pair were convicted of "forming a terror group" which went on to carry out a series of armed attacks in the kingdom.
They included the storming of the kingdom's Jaw prison in January 2017 that killed a guard and led to the escape of 10 detainees, the prosecutor said.
That attack was followed by two separate fatal attacks on police officers later the same month, the prosecutor added.
The convicts were put to death along with a third death row prisoner found guilty of murder.
Their families had been called to the prison on Friday for a final visit, Human Rights Watch said.
In an 11th hour appeal for clemency, HRW's acting Middle East director Lama Fakih warned that King Hamad was committing a "grave injustice by ratifying the death sentences of the two men despite the allegations of torture and other serious due process concerns".
Ruled for more than two centuries by the Sunni Al-Khalifa dynasty, Bahrain is mostly Shiite Muslim, according to unofficial estimates contested by the government.
Hundreds of protesters have been jailed since 2011, with Bahrain claiming Iran trained and backed demonstrators in order to topple the Manama government -- an accusation Tehran denies.
All opposition groups have been outlawed and disbanded.