This sound effect can be found on the Lucasfilm Sound Effects Library, which was made by Sound Ideas. It was recorded by either Ben Burtt and/or Randy Thom, and it debuted in Star Wars: Episode V - The Empire Strikes Back (1980).
Links:
https://soundeffects.fandom.com/wiki/Sound_Ideas,_COUPLING_-_FREIGHT_CARS_COUPLING_IMPACT,_TRAIN#Audio_Samples