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.