Russians and Turks have never been allies. Russians and Muslims have traditional enemies since the early years of the Russian Empire.
The bombing was because Isis gets its money from exporting oil in trucks from Syria and Iraq across the Turkish border into Turkish ports. The Turks have to know what has been going on here, and of course, Turkey easily could block the passage of convoys of oil tanker trucks across the border. Of course, it is not just Isis who is running oil tanker trucks across the border, but the reality is that everyone who is doing this is an enemy of Assad. Assad controls the Syrian seaports.
The less oil that goes across the border, the less money Isis and other Assad enemies will have. So bombing the oil tankers is clearly a useful military operation.
Whether the plane was really violating Turkish airspace is in dispute. Of course, the plane was most concerned with bombing oil truck convoys. Putin is noted for his habit of violating borders. The Turks knew that it was a Russian plane, and shot it down deliberately. It may have been deliberately flying over Turkish airspace as well.