<?php 
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
$categories = $product->getCategoryIds(); /*will return category ids array*/
echo '<label>'.__('Categories: ').'</label>';
foreach($categories as $key=>$category){
    $cat = $objectManager->create('Magento\Catalog\Model\Category')->load($category);
    if (!$cat->getIsActive()) {
        continue;
    }
    echo '<a href="'.$cat->getUrl().'">'.$cat->getName().'</a>';
    if($key == 2){
		break;
	}
	echo ', ';
}