This issue most frequently occurs because the Community Sites or the SharePoint Server Publishing feature is currently enabled or was previously enabled for the affected site.
SharePoint doesn’t support creating a template from a site where publishing or community features were enabled. This is because the publishing feature creates site elements that are not supported as part of a template, and these elements remain even when the feature is disabled. This also includes templates that were created through SharePoint Designer.
Note Although the Save site as template option may become available after you deactivate publishing features, it is still unsupported to create a template from a site that has ever had publishing features enabled. If you create a site from this template, you may encounter problems when you try to activate publishing on the new site. For example, you may receive the following error message:
Provisioning did not succeed. Details: Failed to initialize some site
properties for Web at Url: '......' OriginalException: Failed to
compare two elements in the array.
Microsoft has explained it brilliantly at their support site, read in detail here
Update:
Even after that if you are keen to save site as template keeping your Publishing Feature activated, then refer Save SharePoint 2013 publishing site as a template