Travelling around Madagascar is not inherently dangerous - there isn't a single venomous snake on any of the islands. There is no reason for you to be overly concerned about your personal safety. However, as when travelling anywhere in the world, some common-sense precautions are always warranted.
Some areas along the Malagasy coastlines are subject to danger from sharks and strong currents. Make sure to seek local advice before heading into the water. To avoid stepping on sea urchins or nibbling crabs always wear shoes when walking on the beach or swimming in the water.
In rainforests watch for leeches in muddy areas or during the rainy season. Wear your socks over your trousers (OK, we know how freaking dorky that sounds, but it does work), apply insect repellent, and carry salt to remove any leeches that do get in. Mosquitoes are also ubiquitous - wear insect repellent, especially at dawn and dusk.
If you've travelled in other parts of Africa you will be shocked at how safe Madagascar feels. Pick-pocketing and snatch-and-grab robberies are the most frequent crimes. You can usually avoid any trouble by dressing down (leave the diamonds at home), walking confidently and carrying as few valuables as possible.
A combination of packed and unroadworthy vehicles, reckless drivers and poor-quality roads makes taxi-brousse (bush taxi) travel in Madagascar, and to a lesser extent the Comoros, fairly hazardous. To minimise the risks, try to avoid night travel if possible.
Be wary of organising trips with someone you met at the airport on arrival in Madagascar. It's always best to wait and get a recommendation from your hotel or other travellers first. While most official guides are very competent and well trained, some guides are reluctant to do the full circuit they've been paid for, while others ask for higher fees than those set by the park.