Going through this checklist will help you to solve this error.
Is the User Profile Service running on a single SharePoint server?
If you haven’t restarted your server or done an IIS reset since you set up the User Profile Service you may want to perform an IIS reset and try it again.
Is the configuration for the User Profile Import user done?
Configure the permissions for your import account as described in the TechNet article: Grant Active Directory Domain Services permissions for profile synchronization in SharePoint Server 2013
Has the Sync Connection name more than 15 characters?
Central Administration > Application Management > Manage service application > User Profile Service Applcation > Configure Synchronization Connections
If yes, shorten the sync connection name in the User Profile Service and try again.
Is the User Profile Synchronization Service running under the SharePoint farm account?
Central Administration > Security > Configure service accounts
If the service is not running under the farm account, change it.
Is the farm account a local server administrator?
Computer Management > Local users and groups > Groups > Administrators
If not, add the farm account to the local “Administrators” group. You may remove it after the service has been started.
Is the startup type of the Forefront Identity Manager Service and Forefront Identity Manager Synchronization Service set to automatic?
Computer Management > Services and application > Services
If it’s set to disabled, change it to automatic. You may start the Forefront Identity Manager Service if the service is not running. Do not try to start the Forefront Identity Manager Synchronization Service in console. Make sure both services are running under the farm account. If they are not, double check the settings of the previous steps.
Has the User Profile Synchronization Service been started?
Central Administration > System Settings > Manage services on server
Start the User Profile Service first. Then try to start the User Profile Synchronization Service and enter the credentials of the farm account. If the service is not starting, restart your server and repeat the last two steps.