Every country's embassy or consulate can issue some form of emergency travel document when a passport is lost abroad, typically a limited-validity document good for a single or short journey home or onward, issued much faster than a full passport, often within a day or two once your identity and citizenship are confirmed. Some countries can alternatively issue a full replacement passport abroad, which takes longer, so the first decision is whether you need to travel soon or can wait for the real thing.
The standard requirements: a police report for the loss, passport photos, proof of citizenship, which is where a stored photocopy or scan of the lost passport becomes gold, any other ID you hold, completed application forms, a fee, and sometimes evidence of your travel plans. Book the embassy appointment immediately since that is often the longest lead time in the whole process.
Two wrinkles people miss: the emergency document may need an exit visa or stamp from the host country's immigration authorities before you can leave, particularly if your visa was in the lost passport, and the embassy will advise on that step; and some transit countries do not accept emergency documents, so if you are flying home with connections, have the embassy or airline confirm your routing works with the document you are issued.