The diode is there to protect the opto-LED in the event of a reverse polarity connection.
The HF11L datasheet states that the absolute maximum reverse voltage for the emitter (meaning the IR emitter, the LED) is 6 V. Typically a 5 V supply would be used for the MIDI driver but it's worth being careful.
In your case pretty well any diode - including an LED would suffice. A red LED would limit the reverse voltage to < 2 V and would serve as an indication for reverse connection.
For further reading have a look at Failure modes for LEDs and Opto-isolators - intro where I have written a little on the topic.
@CL raises a point that I rarely have to think about as it's not generally a problem in Ireland due to the damp climate: static. A static discharge of the wrong polarity can exceed the maximum reverse voltage by a factor of many thousand. The reverse diode protects the LED from this.
More reading: