Regrettably, there are many countries with legal or customary restrictions on the Bible. While a total ban is comparatively rare (e.g., North Korea punishes any possession of religious literature by death or imprisonment), it is more common for ownership or distribution to be limited:
To certain government-approved groups only. For example, China allows distribution of Bibles for churches or seminaries that are part of the Three-Self Patriotic Movement / China Christian Council, and they are sold in some bookshops, but cannot generally be mail-ordered by individuals or unregistered churches. Several other nations require government approval before religious books (or any books) can be printed.
To foreigners only. Maldives says citizens must be Muslim, and foreigners are allowed to practice their religion in private; Bibles can be imported for personal use.
In certain languages only. Morocco allows Bibles in French, English, and Spanish, but not Arabic.
Can’t publish, but can import. Turkmenistan does not allow publication of Bibles. They can be imported, in limited numbers and with permission, by registered churches.
Restrictions on attempts to convert members of other religions may also result in de facto bans on Bibles. Similarly, government actions in the name of “public order” may have the same effect, even if there is no law specifically banning Bible publication or ownership. In several cases, effective bans on religious freedom take place despite supposed constitutional guarantees to the contrary. Experiences may vary in different parts of the same country, or at different times.
So “illegal” is perhaps the wrong word, and we should instead be thinking of “Can anyone easily obtain a Bible in this country without attracting official difficulties?”. Any such list will have fuzzy edges, of course. One indicator might be the ease with which Bible societies are able to do their work. They are organized groups with a missionary element and so the bar is higher for them than for private individuals.
The Gideons have a list of countries where they are not allowed to operate:
Afghanistan, Algeria, China (People’s Republic), Comoros, Djibouti, Iran, Iraq, Libya, Maldives, Mauritania, Morocco, North Korea, Saudi Arabia, Somalia, Tunisia, Turkmenistan, Uzbekistan, Yemen
However, for some of these countries, other groups exist: there are United Bible Societies chapters for Algeria, Iraq, Morocco, and China, and some presence in Comoros, Djibouti, Mauritania and Somalia. The Catholic Bible Federation also operates in Iran. Not all of these efforts may be entirely government-approved.
For more detailed information, the US State Department issues annual reports on religious freedom with detailed assessments of the conditions on the ground in each country. In particular, they distinguish between what the country’s law says, how the government acts, and how the wider society responds.