We don’t know your network setup. But your Nextcloud setup needs to be accessible from outside your home in order to sync the calendars as well. If you haven’t opened any ports yet, you’ll probably have to do it. But there are no ports specifically for caldav or carddav only, they all pass through http/https (80/443).