Madagascar is a fairly safe country. You must, however, respect some simple principles:
Don't provoke stray dogs.
Don't walk around at night in Antananarivo other cities are pretty safe.
Don't exhibit signs of wealth cameras, jewels, ....
Similarly, always carry small bills. Paying with large bills shows off your wealth, can insult the seller because they will not have change, and opens you up for becoming a target.
Don't resist in case of aggression.
Keep an eye on your belongings when using public transportation or visiting markets where numerous pickpockets swarm.
Learn the Malagasy word for thief, "Mpangalatra" which is pronounced "Pun-gul-ah-tra". If someone is trying to rob you in a busy market area scream this. The fact that a vazaha is screaming thief will unsettle the thief as well as alert the people near you to help.
Always listen for the words "vazaha" or "vazongo" when spoken in low tones. If you hear these words be aware that someone is talking about you, for better or for worse!
It should also be noted that, like any other developing country, the presence of beggars never goes unnoticed. This is sometimes uncomfortable for tourists, but these people should be respected none-the-less. They are, predictably, attracted to foreigners and will not hesitate to ask for a hand out. If you don't want to be bothered, a simple "Non, merci" or "Tsy Misy tsee-meesh" I have nothing will do the trick. If they persist, try shouting "Mandehana! man-day-han" Go Away!. It is recommended not to give money, but other useful items, such as a banana, a piece of bread, etc. It is usually accepted with gratitude, and if the beggar is a child, he will run away with a smile on his face. Don't give money, take the children to a hotel and buy them something NUTRITIOUS, not candy.It is imperative not to encourage begging - in Madagascar the people do not really believe in getting something for nothing and will invariably offer you something first. For example a chameleon to photograph.
While the AIDS epidemic has not reached the devastating level found in many southern African countries, it is widely assumed that the incidence of AIDS is underestimated and rising. You should take no risks and avoid unprotected sex in all cases.
Areas inhabited by humans will invariably have large populations of stray dogs. Never provoke a stray dog, and although bites are rare, if bitten seek medical assistance promptly as rabies is not unheard of.
Research malaria prophylaxis options, and follow through. If you are not taking any prophylactics, be sure to always use a mosquito net for sleeping, and apply mosquito repellents once dusk sets in. On-skin repellent only repellents containing ~40% DEET are effective, such as NoBite, Azeron Before Tropics etc. is good but should be used in combination with on-clothes repellent i.e. NoBite. The clothes repellent is odorless approximately an hour after application, and clothes can be washed up to 4 times before it needs to be re-applied. If you wear long-sleeve clothing treated with the repellent and apply on-skin repellent to the skin parts not covered, you will be very safe against mosquito bites and can skip the prophylaxis with its notorious side effects. Be sure to take the repellent issue seriously, though, as it's very easy to fall into a more 'relaxed' mode after you've spent some time in the country.
Remember that Madagascar is in the tropics and take precautions against sunburn and heat exhaustion seriously. Wear lots of sunscreen and keep hydrated. Remember that a cloudy day does not mean you won't get burnt.
Everyday life in Madagascar is regulated by numerous fady taboos which vary from one region to another. They can forbid foods pork, lemur, turtle... , wearing clothes of a particular colour, bathing in a river or a lake. Observance of "Fady" is mostly limited to rural areas, as tourists will most likely not run into this problem if they stay in the main towns. However, there are Fady's in places such as Antananarivo but most Vazaha are exempt.
Fady are attributed to ancestors, to whom Malagasy adopt a respectful attitude whatever their religion. It is safest to respect these prohibitions and not violate them, even if you feel they don't make sense. Inform yourself about local fady when you arrive in a new place.
When addressing anyone older than you or in a position of authority e.g. police, military, customs officials, use the word "tompoko toom-pook" the same way you would use "Sir" or "Ma'am" in English. Respect for elders and authority figures is important in Madagascar.
Do not ever take photos of a tomb without permission. Always ask permission before taking photos. Also, if you go to a remote village or hamlet it is fomba or tradition that you first meet with the head of the village if you have business in the village. Meeting this person can save you a lot of time if you have work to do there.
The remarkable thing about Madagascar is that the entire island speaks one language: Malagasy, an Austronesian language. As well as being the name of the language, "Malagasy" also refers to the people of the island. Because the island is so large there are many different dialects. The Merina dialect is the "Official Malagasy" of the island and is spoken around highlands of Antananarivo. Most Malagasy, however, speak Merina across the island.
French is the second official language of Madagascar. The government and large corporations use French in everyday business, but 75-85% of Malagasy only have limited proficiency in this language. Attempts by foreigners to learn and speak Malagasy are liked and even encouraged by the Malagasy people.
The Malagasy people are generally considered to be patriotic. When Madagascar gained independence from France, the Malagasy changed much within the culture and languages, returning back to their original customs and traditions again. Today, Malagasy is the daily language spoken by 98% of the population in Madagascar, and since 1972, Malagasy language has been used as the teaching language in some schools. However, some of Malagasy people are familiar or even fluent with French very widely spoken except in some rural areas, English or German spoken by very few people, mainly guides.
Note for independent travellers: at least a basic knowledge of French is recommended.