In the hotels and resorts there'll be no problems, but if you're visiting Stone Town or other off-resort destinations it is prudent to observe local customs, and at least make concessions to them. No bikini tops, bare shoulders etc. No need for a full niqab, but a shawl to cover shoulders, and a wrap or skirt that is knee length seems sensible.
We have more travel tips for Tanzania here:
http://www.worldnomads.com/travel-safety/tanzania/ almost 2 years ago