What does it mean for the ratio of the lengths of the sides of a rectangle to be rational, say $\frac{5}{3}$? It means that if the long side of the rectangle is divided into five equal parts, and if one counts out three of those parts, then the length of the resulting line segment equals the length of the short side of the rectangle. The short side can now be divided into three parts all equal to the parts of the long side. Hence the rectangle can be tiled as a $3\times5$ array of squares.

Conversely an $m\times n$ array of squares forms a rectangle whose ratio of sides is the rational number $\frac{n}{m}$. So to say that the ratio of sides of a rectangle is rational is the same as to say that the rectangle can be tiled as an array of squares. The question now is, can every rectangle be tiled as an array of squares? The answer isn't obvious. One might imagine that as long as we make the squares small enough, it can always be done.
Before answering this question, let's imagine that someone has told you that a rectangle can be tiled as an array of squares but hasn't told you what size square to use. How would you go about finding the size of square? To approach this, notice that if you manage to find a square that tiles a given rectangle, the same square will tile the shorter rectangle you get by chopping off a square section from the long end of the rectangle.

On the other hand, if the rectangle is, in fact, a square, then the rectangle is a square tiling of itself (using only one tile). Because of these two properties, we can find the square we want by chopping square sections off of the rectangle until the remainder rectangle is itself a square.

By reversing the process, this remainder square will tile the original rectangle, as the following image should make clear.

At this point, the idea that every rectangle can be tiled as an array of squares may seem much less plausible than it did previously. In order for a tiling with squares to exist, the remainder rectangle in the chopping-off process must eventually be a square. But it is not clear that this always has to happen. Why couldn't it be the case that, for certain rectangles, the chopping-off process continues forever, never resulting in a square? After all, for the remainder rectangle to be a square, its two sides have to be precisely equal. That the two sides should always be at least slightly unequal seems much more probable, from a random starting rectangle, than that they should ever be exactly the same.
These misgivings are all well-founded, but the true situation can actually be even worse than this. For certain starting rectangles, the sides of the remainder rectangle never even get close to approximate equality, much less exact equality. This happens, for example, when the sequence of remainder rectangles falls into a repeating pattern, which occurs when a remainder rectangle is geometrically similar to an earlier remainder rectangle in the sequence.
The simplest example of such a rectangle is the golden rectangle, which is defined by the property that chopping a square section off of the long end of the rectangle results in a rectangle that is similar to the starting rectangle. The ratio of the long side to the short side is known as the golden ratio and has decimal expansion $1.61803\ldots$. All remainder rectangles in the sequence have side lengths in this ratio, and hence none is ever close to being square. As a consequence, the golden rectangle cannot be tiled as a rectangular array of squares, and therefore the ratio of its side lengths is not rational.

The defining property of the golden ratio implies that its value is $(1+\sqrt{5})/2$. It turns out that similar numbers involving square roots, that is, numbers of the form $r+s\sqrt{d}$ where $d$ is a natural number that is not a perfect square and $r$ and $s$ are rational numbers, always fall into a repeating, but generally more complicated, pattern of remainder rectangles. None of these numbers are rational.
These examples are but the simplest way to see the phenomenon of irrationality. An interesting irrational number has decimal expansion $1.433127\ldots$. If the chopping-off process is carried out on a rectangle whose horizontal side has this length and whose vertical side has length $1$ then, after chopping a square off the long side, the vertical side becomes the long side; after chopping two squares off the long side, the horizontal side again becomes the long side; after chopping three squares off the long side, the vertical side becomes the long side; after chopping four squares off the long side, the horizontal side becomes the long side; and so on. Hence among the remainder rectangles are rectangles that become progressively longer and longer relative to their width. Assuming that this continues, it follows that the remainder rectangle is never a square and hence that that original rectangle does not have a whole-number ratio of sides. Actually proving that this pattern continues for this particular ratio (which is $I_0(2)/I_1(2)$, where the functions $I_n(z)$ are things called modified Bessel functions of the first kind) is considerably more work than in the case of the golden ratio.
A more familiar number that exhibits a similar, but more complicated pattern is $e$, which is therefore also irrational. The chopping-off pattern in this case is
$[2,1,2,1,1,4,1,1,6,1,1,8,\ldots]$, where the the numbers represent how many squares get chopped off with each change in orientation of the long edge. Unlike the examples we have looked at so far, however, most irrational numbers exhibit a rather unpredictable chopping-off pattern. For example, $\pi$ has the pattern $[3,7,15,1,292,1,1,1,2,\ldots]$. In any case, it is only when the chopping-off process terminates that the side lengths have a whole-number ratio.
Incidentally, the chopping-off process is usually called the Euclidean algorithm, and the sequences of numbers representing squares chopped off with each change in orientation of the long side are called the coefficients of the continued fraction. Examples of continued fraction coefficients for various numbers, some of which were discussed in this post, are listed below.
$$
\begin{aligned}
5/3&=[1,1,2]\\
22/9&=[2,2,4]\\
99/34&=[2,1,10,3]\\
(1+\sqrt{5})/2&=[1,1,1,\ldots]\\
\sqrt{2}&=[1,2,2,2,\ldots]\\
(6+\sqrt{10})/4&=[2,3,2,3,1,3,2,3,1,3,2,3,1,\ldots]\\
I_0(2)/I_1(2)&=[1,2,3,4,5,6,\ldots]\\
e&=[2,1,2,1,1,4,1,1,6,1,1,8,1,1,\ldots]\\
\sqrt[3]{2}&=[1,3,1,5,1,1,4,1,1,8,1,14,1,10,2,1,\ldots]\\
\pi&=[3,7,15,1,292,1,1,1,2,1,3,1,14,2\ldots]
\end{aligned}
$$