Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.
Let's say that a curve $C$ is given by the equation $f$ if we have $C = \{(x,y) \in \mathbb{R}^2, \, f(x,y) = 0\}$.
If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 \cup C_2$ is given by $f_1 . f_2$ and $C_1 \cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 \cup C_2$ and $C_1 \cap C_2$.
If $C = \{(x,y) \in \mathbb{R}^2, \, f(x,y) \ge 0\}$, then $C$ is given by the equation $|f|-f$.
Now, any segment $S$ can be described as $S = \{(x,y) \in \mathbb{R}^2, \, a x + b y = c, \, x_0 \le x \le x_1, \, y_0 \le y \le y_1\}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.
EDIT : For the specific case of the octagon of radius $r$, if you denote $s = \sin(\pi/8)$, $c = \cos(\pi/8)$, then one segment is given by $|y| \le rs$ and $x = rc$, for which an equation is
$$f(x, y) = \left||rs - |y|| - (rs - |y|)\right| + |x-rc| = 0$$
So I think the octagon is given by
$$f(|x|,|y|) \ f(|y|,|x|) \ f\left(\frac{|x|+|y|}{\sqrt{2}}, \frac{|x|-|y|}{\sqrt{2}}\right) = 0$$
To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = \cos(\pi/n)$, $s_n = \sin(\pi/n)$ and
$$f_n(x+iy) = \left||rs_n - |y|| - (rs_n - |y|)\right| + |x-rc_n|$$
then your polygon is given by
$$\prod_{k = 0}^{n-1} f_n\left(e^{-\frac{2 i k \pi}{n}} (x+iy)\right) = 0$$
Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).
Best Answer
In general, $\left|(x - h) + (y - k) \right|+\left| (x - h) - (y - k) \right|=r$ describes a square centered at (h,k) and having side length r.