Zanzibar is an amazing place I worked there for a year in 2008at one of the biggest dive centers on the island.
Yes you do need to be careful, there are people who will want to steal from you the locals are paid very poorly and some decide to take the easy route to money. I personally never suffered any loss but the dive center I worked for was broken into one evening and the money, laptop etc stolen.
Being female there you need to respect the locals, cover shoulders and knees when out unless you are in a resort area where this is acceptable. This is easy to do. Be sensible, dont wander around alone at night with camera's etc on show.
I was based in Stone town, which is an amazing place, lots of small alleys and teaming with history, but not the safest place alone in the evening. The beaches to the north are more set up for tourists with hotels and private beaches, very relaxing.
Diving can be from stonetown, which are reefs and a couple of wrecks, nice dives and lots of life, from the north you can dive the Mnemba atol, everyone says it is the best diving and it is good, but I liked the area I worked in.
Down in the South West there is Kizemkazi where the dives are amazing, but more difficult to get around there and more basic.
I worked with One Ocean owned by Gary, he is a great guy with more than 20 years in Zanzibar and runs good dive centers in both Stone town, and on the East coast. He also manages a resort called Matenwe Beach resort on the East coast.
Dont just right the place off, but do be careful if you go.