In the US, the Speedy Trial Clause and the Due Process Clauses require some limit on the time the accused has to wait for trial. A statute of limitations statutorily encodes what is a reasonable delay (if SCOTUS thinks that 5 years is too long a time, they can so rule and Congress will have to change the law). The practical rationale for limiting the delay on trying a person is that after 30 years, memory of the details surrounding an event are likely to be very unreliable, so that witnesses on both sides are of limited value. In addition, the limit motivates law enforcement to investigate the problem in a timely manner.
The federal law, in the general (noncapital) case, is that the limit for all crimes is 5 years, There are various longer limitations, including none for capital offenses. Criminal contempt has a shorter limit of one year, and otherwise 5 years is the shortest period for criminal prosecution at the federal level. The reason why perjury has a 5 year limit is that it is not one of the specific more serious offenses and it is not criminal contempt. The limit in 1948 was 3 years, and was increased to 5 years in 1954. You could look for records of congressional debate to see why they increased that from the original limit (1 Stat 119) of 2 years for non-capital offenses.
You could make a political argument for a longer or shorter limit, on Politics SE: the point is that no limit could cause constitutional problems, and nitpicking over 2 vs. 5 is strictly political.