The basic habanera rhythm (Orovio 1981:237)
In the mid-19th century, the habanera developed out of the contradanza which had arrived from France via Haiti with refugees from the Haitian revolution in 1791.
The earliest identified "contradanza habanera" is "La Pimienta", an anonymous song published in an 1836 collection. The main innovation from the contradanza was rhythmic, as the habanera incorporated Spanish and African influences into its repertoire.
It is believed that the habanera was brought back to Spain by sailors, where it became very popular for a while before the turn of the twentieth century. Spanish composer Sebastian Yradier was known especially for his habanera "La Paloma",
which achieved great fame in Spain and America and was largely responsible for the habanera's success to come. The habanera was danced by all classes of society, and had its moment of glory in English and French "salons" (ballrooms).
The habanera was so well established as a "Spanish" dance that Jules Massenet included one in the ballet music to his opera Le Cid (1885), to lend atmospheric color.