This duty was established by the labour courts. Skipping it, or holding a hearing for appearances only, can lead to compensation even where the dismissal itself was justified.
The invitation must be given in writing, with reasonable time to prepare a response, and the employee may attend accompanied. The decision is taken after the hearing, not before. A record of what was said protects both sides.
Dismissal also carries prior notice and, as a rule after one year of employment, severance pay (פיצויי פיטורים). Documenting each step properly protects both sides.