The unidentified assailants on a motorbike opened fire at Abdulhadi Mohammed near his house in the Mansura district, killing the judge, a police official said, adding they managed to flee.
There has been a growing number of attacks and assassinations in Aden, the government's temporary capital, by jihadists targeting members of the security forces and government officials.
Al-Qaeda and the rival Islamic State group both have a presence in the city, where jihadists occupy government buildings and are seen patrolling several districts and intimidating civilians.
Loyalists backed by a Saudi-led coalition have regained control of Aden and four other southern provinces since July, but the rebels still hold Sanaa and have besieged the third city of Taez for months.