Turkey backs Libya's internationally-recognized Government of National Accord (GNA). It has signed a military cooperation deal with the GNA, which has been trying to fend off an offensive by Haftar's forces.
Ankara views Haftar's forces, which are backed by the United Arab Emirates, Egypt and Russia, as "putschists."
"If our missions and our interests in Libya are targeted, we will deem Haftar's forces legitimate targets," the foreign ministry said in a statement in which it also slammed the United Nations for not taking action over Haftar's attacks.
"It is unacceptable for the United Nations to remain silent against this carnage any longer," it said. "Countries providing military, financial and political aid to Haftar are responsible for the suffering that the people of Libya are enduring and the chaos and instability the country is being dragged into."
It also said attacks on Tripoli's Mitiga airport early on Saturday, part of an intensified barrage of artillery fire on the capital, were war crimes.
On Thursday, Turkey and Italy said the area around their embassies in Tripoli had been shelled.
Haftar's Libyan National Army (LNA) has been fighting for more than a year to capture Tripoli from the GNA with frequent shelling of the capital. The United Nations said four fifths of the 130 civilian casualties recorded in the Libyan conflict in the first quarter of 2020 were caused by LNA ground fighting.
Turkish President Tayyip Erdogan said on Monday the LNA was in a "period of regression" after NATO member Turkey threw its support behind the GNA.
"Even the efforts of countries that provide him (Haftar) with unlimited financial support and weapons will not be able to save him," Erdogan said.
Pro-GNA forces have retaken some territory from the LNA around Tripoli during an escalation of fighting in recent weeks with the help of Turkish-supplied drones.The LNA says Turkey has established a military drone base at Mitiga, but the GNA denies this.