NATO is essentially an organisational structure on top of the North Atlantic Treaty - members of NATO are signatories of the treaty, who work to implement the articles set forth in the treaty and coordinate through NATO to accomplish those goals. Theoretically speaking, NATO would 'function' with anywhere down to two remaining members, if you consider 'functioning' to mean 'attempting to implement the articles of the NAT' - though their effectiveness would obviously depend on which nations were remaining.
But lets take a look at the articles of the treaty and see how Turkey's withdrawal from NATO would impact their ability to function.
The Parties undertake, as set forth in the Charter of the United Nations, to settle any international dispute in which they may be involved by peaceful means in such a manner that international peace and security and justice are not endangered, and to refrain in their international relations from the threat or use of force in any manner inconsistent with the purposes of the United Nations.
This relies on NATO members having some weight to throw around on the international diplomatic stage - being able to influence other nations to calm tensions, through some form of negotiation. Losing Turkey may have some effect on NATO's ability to influence Middle-East nations as it's the only Islamic majority full-member, but most of the major nations (US, UK, France, Germany, etc.) have more than enough power to carry out this goal.
The Parties will contribute toward the further development of peaceful and friendly international relations by strengthening their free institutions, by bringing about a better understanding of the principles upon which these institutions are founded, and by promoting conditions of stability and well-being. They will seek to eliminate conflict in their international economic policies and will encourage economic collaboration between any or all of them.
Relates mostly to internal matters of members. Given some of the recent developments in Turkey, their leaving NATO may in effect strengthen the 'average' carrying-out of this article.
In order more effectively to achieve the objectives of this Treaty, the Parties, separately and jointly, by means of continuous and effective self-help and mutual aid, will maintain and develop their individual and collective capacity to resist armed attack.
Again, internal to each nation. Turkey's military may be the second largest, but even without the US the combined strength of other NATO nations would be stronger.
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.
As long as there's at least two members, this can be carried out.
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.
Any such armed attack and all measures taken as a result thereof shall immediately be reported to the Security Council. Such measures shall be terminated when the Security Council has taken the measures necessary to restore and maintain international peace and security.
The big one. As this only applies to NATO members, losing Turkey doesn't impact the requirements on the other nations - it simply means they won't be called upon to defend an attack on Turkey. Theoretically this means they don't have a legal way to defend Turkey from, say, Russian invasion, and would have to cede that territory in the event of a conflict. Turkey was admitted to NATO specifically to prevent this eventuality (easy Russian access through the Bosphorus), but NATO itself functions regardless.
For the purpose of Article 5, an armed attack on one or more of the Parties is deemed to include an armed attack:
on the territory of any of the Parties in Europe or North America, on the Algerian Departments of France 2, on the territory of Turkey or on the Islands under the jurisdiction of any of the Parties in the North Atlantic area north of the Tropic of Cancer; on the forces, vessels, or aircraft of any of the Parties, when in or over these territories or any other area in Europe in which occupation forces of any of the Parties were stationed on the date when the Treaty entered into force or the Mediterranean Sea or the North Atlantic area north of the Tropic of Cancer.
This would possibly have to be revised to remove the specific references to Turkish territory should Turkey leave NATO, although it may be desirable to leave this provision in place so that theoretically a NATO member attacked while deployed in/near Turkey could trigger the response - it'd be up to the members to decide.
The remaining articles 7-14 are administrative in nature, and are not impacted by Turkey leaving NATO.
So in closing, yes - NATO can function without Turkey. Turkey was admitted to NATO for strategic reasons and it'd hurt NATO to lose control over Russian access to the Mediterranean, but the organisation would still have significant military, economic, and diplomatic weight to throw around through its stronger members.