Try to using this
$productId = 1;
$productRepository = $objectManager->get('Magento\Catalog\Api\ProductRepositoryInterface');
$product = $productRepository->getById($productId);
$product->getProductUrl();
It just an example don't use objectManager directly you can inject the class Magento\Catalog\Api\ProductRepositoryInterface to constructor