How to get Forgot Password Url in Magento 2?

You can retrieve the forgot password URL from the Customer Module of Magento.

The customer module contains the Forgot password feature for the Account Section. If you have created an account with Magento and you forgot the password and want to reset the password, You can get forgot password page URL by just instantiate the Url Class of Customer Module.

Class to instantiate in the constructor:
Magento\Customer\Model\Url

<?php
namespace Jesadiya\ForgotPagelink\Model;

use Magento\Customer\Model\Url;

class UrlLink
{
    /**
     * @var Url
     */
    private $url;

    public function __construct(
        Url $url
    ) {
        $this->url = $url;
    }

    /**
     * Get forgot link
     *
     * @return string
     */
    public function getForgotPasswordUrl()
    {
        $url = $this->url->getForgotPasswordUrl();
        return $url;
    }
}

Call the function inside the template,
echo $forgotPageUrl = $this->getForgotPasswordUrl();

Method contains the URL path like, customer/account/forgotpassword.

Url path will be appended to the Base Url of the store.

Output:
http://magento2.docker/customer/account/forgotpassword.