When using LDAP user federation, Keycloak does not know about the recent used passwords and password policies are not used at all, because the policies configured in Keycloak might possibly clash with policies in LDAP. With LDAP user federation, only the password policies living in the LDAP will be taken into account, but by the LDAP itself, not by Keycloak.
In the meantime the feature was introduced, that you can configure in LDAP user federation settings that also the Keycloak password policies should be evaluated. But I doubt that this will work with the most recent n passwords, as Keycloak doesn’t know about the passwords used in LDAP. IMHO only semantic password policies will work properly.