Yes, in most countries foreigners can absolutely call emergency services, and the number works from any phone regardless of your nationality or visa status. Never hesitate to call because of language worry or immigration fear; emergency services exist to help whoever is in danger, and in most places they do not concern themselves with your paperwork in a medical crisis.
Language support varies. Many big-city dispatch centers can handle English or transfer you to an interpreter line, while smaller towns may be local-language only. If language fails, stay calm and communicate the essentials: your location first, then the type of emergency. Even a few memorized local words for help, ambulance, fire, and police, plus your address, can carry a call. Some countries also offer emergency text or app-based services, useful if speaking is difficult.