The best way is to contact to your HR department. There is no doubt that since you have failed the medicals, you have to go back to your country. Ask your company whether they can provide you the return ticket and the salary for the duration for which you have worked with them.

Don't lose hope as there are many alternative opportunities in life and hope something better is in store for you. All the Best!!!!

Life is never boring, but some people choose to be bored.... Boredom is a choice. - Wayne W.