Petra (Wadi Musa) is a city in Jordan famous because it's the closest inhabited place to Petra, where the tourist use to sleep before to enter the archaeological park.
From inside Wadi Musa you can try to hitchhike to the exit of the town, a roundabout in the northeast. From there you have to hitchhike to the Desert Highway; the main road of the country. From the Desert Highway is super easy to hitchhike to the north, the south, etc. It's better to use the Desert Highway than the King Highway because there is more traffic and it's easier.
In front of the roundabout where you have to hitchhike there is a police station. Don't be afraid about them because they are very friendly. One police man even stopped cars for us (march 2019).
Other useful info
As Wadi Musa (Petra village) is a tourist city created for tourism, you will find that local people (mostly bedouins) will try to make you pay for the ride. They know how to make the people pay for everything so take care, because they will try to convince you that it's impossible to hitchhike out from Wadi Musa (and it's not)
Be aware about Fridays; the muslim day off. There are not so much people driving on Fridays, and around 12.00 the city is empty, so it will be quite difficult to hitchhike. On Fridays it can be easier to hitchhike with tourist people.