Question: Does the union of intervals form a set? I mean the union of $(0,1)$ and $(1,2)$ is a set and if yes, then how?

Answer: 
A set is a collection of elements. In this case, all elements are real numbers.

Any interval $(a,b)$ *is a set* (the set of those real numbers $x$ which satisfy $a<x<b$.)

The union of any two sets is still a collection of elements, i.e. **is a set**.
It is because each interval is set and union of two sets is set.