This only happens if the triangle is isosceles.
Suppose you have triangle ABC, with AB=AC. In this case, the altitude AH bisects both the base BC and the angle BAC, so triangle ABH and ACH are congruent becase they have AH in common, BH=CH and AB=BC because the triangle is isosceles.