Lime water turns milky when you pass carbon dioxide through it because a reaction that produces a white precipitate takes place.
Lime water is obtained by slacking calcium oxide,
When you pass carbon dioxide through this solution, the two compounds,
The solution will go from being clear to being milky, which is why the resulting solution is known as milk of lime
Calcium oxide, the solid used to make the calcium hydroxide solution, is actually obtained from calcium carbonate, which is known as limestone, by thermal decomposition.
In fact, this whole process is called the lime cycle (sometimes called the calcium cycle), which looks like this