I can answer about the Middle East & North Africa only (the politically so-called "Arab World")
Egypt and Tunisia are not Muslim Countries since Islamic law is only one of the sources of legislation, not the only one, and used only in specific cases.
Muslim Countries are ones like Saudi Arabia, Iran, Kuwait...etc (religious states) whose law is only and fully based on Islamic law (Sharia) i.e. their law is the Islamic law, while in Egypt and others (civil states) the law is Egyptian law and when made the sources for making it were many such as French law and Islamic law, depending on what part of the law is being made (criminal, commercial, family law, personal affairs...etc) but every country has its own traditions, it's not just whether the law is Islamic or not since there are also different interpretations of Islamic law.
I would personally categorize them in three categories:
Extremely conservative - Religious states (this is where you really need to be careful)
which include: Saudi Arabia, Kuwait, Yemen, Iran, Iraq, Oman, Libya
Moderate - usually civil states (you can still have fun in specified ways and certain parts) include: Jordan, UAE, Syria, Qatar, Sudan, Bahrain
Open minded - civil states, usually secular, include: Tunisia, Algeria, Morocco, Egypt, Lebanon
But again every country has its own traditions. For example UAE and Qatar are religiously oriented but serve alcohol and are among the top countries for prostitution. however Egypt which is a civil state and serves alcohol among many things against Islamic law can be very conservative in some districts, example: you cant wear a short skirt in the poorer parts while in Sharm el Sheikh you can sit topless on some beaches.
Anyway in most of the countries I’ve mentioned foreigners are somewhat exempted from traditions applying to locals or at least they forgive you for being a foreigner, there isn’t a case where they will forbid you to do something or punish you legally (except in the extremely conservative) but if you're wearing something too sexy (as a woman) in a common poor district you will get people staring at you the whole time and probably hitting on you, which can be very annoying. While in other parts of the same city you can do all you can think of, the best thing is to have a guide from the country who is open-minded and well educated, not too common because you will get too much wrong information from them.