I know that a(n inbound) travel ban based on nationality is normally enforced at the destination. It is most notable that Israelis suffer this kind of ban from most of the Arabic world.
Another notable examples are North and South Korea, which are reciprocal enemies and do not accept nationals of either nationality. It's also extremely difficult to actually get a passport for North Koreans.
And of course US travel bans issued by Mr. Trump against nationals of certain Muslim countries.
But I wanted to ask about the opposite, mostly for sake of curiosity. Are there countries that forbid and punish their own nationals to visit certain enemy states despite that destination state accepting them?
Example. National of country A
can legally enter state B
(from B's laws point of view, and most likely using a connecting flight), but when that person returns to the home country A
they get prosecuted by law, e.g. if they have passport stamps, pocket money from B
or just any other evidence to have visited that state. I am asking for bans that can be enforced with sanctions (from fines, hefty fines, to jail, revocation of passport, etc.)
From the first example: an Israeli dual national is likely to be able to visit Libya with a second passport, but I never heard about any Israeli law prohibiting individuals to visit Libya (should the government ever find out) and convicting such travelers.