Many countries do set a formal language bar, and it is usually expressed in levels of a standard proficiency framework, with an approved exam certificate as proof. The common pattern: a basic-to-intermediate level for permanent residency and a slightly higher one for citizenship, though plenty of countries skip the PR requirement and test only at naturalization. Some accept completed integration courses, local schooling, or a degree taught in the language instead of an exam, and exemptions often exist for age or medical grounds.
As for time, learners starting from zero typically need a few hundred hours of study to reach the lower conversational levels, and roughly double that for a solid intermediate certificate. In practice that means one to three years of steady evening study for most working adults, faster with intensive courses or a related mother tongue.
Check the exact level, the list of accepted exams, and certificate validity on the immigration authority's site early, because exam slots fill up fast.