NATO could, but doesn't have to.
Article 5 of the north-atlantic treaty reads:
The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individual or collective self-defence recognised by Article 51 of the Charter of the United Nations, will assist the Party or Parties so attacked by taking forthwith, individually and in concert with the other Parties, such action as it deems necessary, including the use of armed force, to restore and maintain the security of the North Atlantic area.
Technically only the west-most part of Turkey is part of Europe, so according to the original wording, technically the NATO defense clause wouldn't be invoked before the enemy crossed the Bosphorus. But with the accession of Greece and Turkey, the NATO area was clarified to include the whole territory of Turkey.
This article guarantees assistance when a member is attacked, not if a member attacks someone else. For a precedent case, consider the many wars the United States were involved in since founding of the NATO. While some NATO states assisted in these wars, there was just one case where the US obligated all of NATO to chip in: the war in Afghanistan which was justified by claiming 9-11 as an armed attack.
Also, "use of armed force" is just one possible form of action the other NATO partners could deem necessary. The articles 1 and 2 point out that a non-violent solution should always be preferred, so any peaceful approaches to the situation would be considered before planning a military counter-strike.
But what if the situation is complicated? People shoot at each other and nobody is sure who and what started it.
In that case Article 4 would likely be invoked:
The Parties will consult together whenever, in the opinion of any of them, the territorial integrity, political independence or security of any of the Parties is threatened.
That means the North Atlantic Council would debate whether or not Turkey is threatened and what they could do to remedy the situation. Military intervention on behalf of Turkey is one option, but it is far from the only one. Which course of action to take would depend on the exact circumstances and the current geopolitical interests of the NATO partners. Some options NATO could take are:
- Nothing, let them sort it out on their own
- Send an angry letter to the aggressor
- Impose sanctions on the aggressor
- Provide Turkey with logistic support (money, weapons, intelligence, consultants etc.) but leave the actual fighting to the Turks.
- Send troops to secure Turkey's borders
- Retaliate by sending troops to attack the territory of the aggressor directly