After a brief free trial period, Nintendo Switch users will have to pay a recurring fee in order to play games online with their friends. The free trial for the Nintendo Switch Online Service will begin in March and end in Fall 2017.

At that time, you will need to pay in order to play online, similar to what Sony has with PlayStation Plus and Microsoft with Xbox Live Gold. Nintendo did also announce that paying subscribers will get access to free games.
Online Play on Nintendo SwitchFall 2017
Online lobby and voice chat
Our new dedicated smart device app will connect to Nintendo Switch and let you invite friends to play online, set play appointments, and chat with friends during online matches in compatible games─all from your smart device.

A free, limited version of this app will be available for download in summer 2017.

Monthly game downloadExclusive deals
Special offers for subscribers may include discounts on select digital games and content.

There doesn't seem to be anything that indicates just how much this fee will be yet.