The law primarily regulates the terms of collective bargaining agreements. Most EU countries provide for such agreements to include a maximum amount of overtime for scheduled hourly workers. Some countries, like the US and Netherlands, don’t specify any maximum. The new Hungary law raises the overtime limit from 250 hours per year to 400. (France, for example, is 220. Norway is up to 400 by individual agreement. In California, there is no annual limit, but workers can’t be disciplined for not working more than 72 hours per week. The Netherlands has no annual limit, but a limit of 60 hours per week. In the new Hungary law, the maximum per week is 48.)
The three years is not how long employers have to pay for the extra hours, but refers to the “reference period” in the collective bargaining agreement over which what counts as overtime is calculated. People must still be paid their hourly rate for those overtime hours. A reference period in excess of court months, moreover, can only be set forth in a collective bargaining agreement.
Calling raising the limit on maximum overtime a “slave law” is propaganda, pure and simple. (Unless you subscribe to the notion that working for someone who privately owns the means of production is “wage slavery” but if that’s the case you should flag that premise to avoid misleading the reader.)