According to Wikipedia, the hash marks in American football were introduced in 1932, at which time they were placed 10 yards in from the sidelines. They have since migrated inward to 15 yards in 1935 and 20 yards in 1945, ending up in 1972 at their current position of 23 yards 1 foot 9 inches in from the sidelines. The 1972 movement is explained in this question, but what were the reasons for the 1935 and 1945 movements?
It made the games more exciting and made offenses less likely to run plays specifically designed to get away from the sideline. In the words of the NFL,
The closer to the center the marks got, the less reluctant offenses became to design plays toward the sidelines, increasing their play-calling options and excitement for fans.
The closer to the center of the field a team is, the more space it has. Big plays and offense, which are both good for NFL profits, become more common. So the change was about offense and less plays being wasted on moving sideways.