Let the endpoints of the stick be $(x,0)$ and $(0,y)$ such that $x^2 + y^2 = r^2$.
The midpoint is $\left(\dfrac{x}{2}, \dfrac{y}{2}\right)$ and it satisfies $\left(\dfrac{x}{2}\right)^2 + \left(\dfrac{y}{2}\right)^2 = \dfrac{r^2}{4}$
So the midpoint moves along a quadrant of a circle of radius $\dfrac{r}{2}$.
Length of a quadrant = $\dfrac{1}{4} \cdot 2\pi \cdot \dfrac{r}{2} = \dfrac{\pi r}{4}$
For $r = 2$, the required length = $\pi$