The Black-Scholes option pricing model provides a closed-form pricing formula $BS(\sigma)$ for a European-exercise option with price $P$. There is no closed-form inverse for it, but because it has a closed-form vega (volatility derivative) $\nu(\sigma)$, and the derivative is nonnegative, we can use the Newton-Raphson formula with confidence.
Essentially, we choose a starting value $\sigma_0$ say from yoonkwon's post. Then, we iterate
$$
\sigma_{n+1} = \sigma_n - \frac{BS(\sigma_n)-P}{\nu(\sigma_n)}
$$
until we have reached a solution of sufficient accuracy.
This only works for options where the Black-Scholes model has a closed-form solution and a nice vega. When it does not, as for exotic payoffs, American-exercise options and so on, we need a more stable technique that does not depend on vega.
In these harder cases, it is typical to apply a secant method with bisective bounds checking. A favored algorithm is Brent's method since it is commonly available and quite fast.