Here's what Baron Cohen says about how Wadiya was initially created, in this interview (short summary):
I said [to the set designer] 'Listen, we want to create this new
country that is not quite in the Middle East, it's not quite in
Africa, but, you know, it has elements of Gadhafi, it has elements of
the United Arab Emirates, it has elements of Turkmenistan. We don't
want it to be specific, but we want it to feel real.
He doesn't mention Eritrea in the interview specifically, which suggests it was a detail filled in by the backroom team rather than part of his initial vision.
It clearly fits the bill:
- Being geographically on the northern tip of East Africa, it's on the edge of but not quite in either the Middle East or North Africa
- Obviously it is part of Africa, but the majority of references to African dictatorships in the film are focussed on North Africa - so it fits the bill in terms of being not specifically in the same region as (North African) Libya or (Middle Eastern) Iraq or UAE (or, Central Asian Turkmenistan), but is close and isn't too geographically different to any of them
- In real life it is a dictatorship frequently ranked one of the most repressive in the world, with a terrible human rights record
After 25 years of rule by unelected President Isaias Afwerki, Eritrea’s citizens remain subjects of one of the world’s most oppressive governments... systematic, widespread and gross human rights violations... Indefinite military service and forced labor... Physical abuse, including torture, occurs frequently... The government owns all media...
- It is also a very insular nation, seldom interacting with the outside world; described by the BBC:
Eritrea is considered one of the most repressive and secretive states on earth
So choosing a country that is somewhat similar geographically and politically helps with the "we want it to feel real" part, and choosing a secretive country few people know much about helps with not being too "specific".
Another likely factor is that Eritrea is a non-religious dictatorship, and not part of the Arab world. Baron Cohen talks at some length about how particularly wanted to avoid people drawing too many connections between his film and the then-recent Arab Spring:
...he's not an Arab dictator, and he actually says that he isn't in the movie. And so we wanted to really ensure that he was not Arabic in any way. So we created a new language...
And in terms of the religion, you know, he's not a Muslim. His religion is himself... we wanted to really make it clear particularly after the Arab spring that this was in no way a parody of Arabs. This was a parody of people who oppress Arabs and people who oppress other people around the world
Expanding on not wanting to be too specific, he explains that the decision to use a fictional country went with the decision to use an entirely scripted plot, unlike his other films; largely for practical reasons:
...we got away with [unscripted pranks] on "Borat" because Kazakhstan was a real country. So you could say I'm from Kazakhstan National Television, and people would look up Kazakhstan, and it existed. But if I came this time and said I'm from Wadiya, they'd, you know, look it up and realize it didn't exist, and if I said listen, I'm the dictator of Turkmenistan or, you know, or Libya, they could look it up on Wikipedia and realize that I'm not
So Eritrea fits what Baron Cohen said he wanted quite neatly. It's a real, repressive dictatorship, that isn't so well known people might view the film as a specific satire of that country, is close to but not part of the Middle East and North Africa, and isn't part of the Arab world so helps avoid looking like this was a satire specifically aimed at Arab dictatorships.
Also, it probably didn't hurt that being a particularly insular and secretive nation, Eritrea was less likely to particularly retaliate or complain.