Above is an example of 50 ohm impedance matching when using a pulse generator. As you see, adding a small shunt resistor Rs here for a very big load resistor adjust the equivalent resistor around 50 Ohm, hence the impedance is matched.

My question is as follows:

I have a function generator and sometimes it is used to output sharp pulses with 10V amplitude.

In that case imagine the generator output is coupled to a load with a quite high resistor like 1GigaOhm. For impedance matching I can then set the Rs as 50 ohm. So far so good.

But now Rs will see around 10V/50Ohm = 200mA for a 99% duty cycle pulse. This corresponds 0.2*0.2*50 = 2 Watt power dissipation.

Wouldn't a usual 50ohm resistor burn out in this case?

Moreover, how can one achieve impedance matching in this case?

You are correct in your power calculation.

Wouldn't a usual 50ohm resistor burn out in this case?

Not if it's a 2-watt or better resistor.

Moreover, how can one achieve impedance matching in this case?

By using a 50-ohm resistor you have achieved impedance matching. If the power rating of the resistor is too low, the resistance will change as the resistor heats up, and matching will fail. As in the first question, the answer is to use a resistor with a 2 watt or better power dissipation rating.