To cross a bridge when you come to it means to deal with a problem when it is imminent. A related phrase advises, don’t cross the bridge till you come to it, changing the meaning to say don’t worry about a problem that may not arise, or don’t allow a future problem to divert your attention from current needs.
Theidioms puts the origin of the phrase in the 1800s, when there was often literal concern over the safety of bridges.
The reliable Phrase Finder had a post asking about the phrase, but no information on the origin.
Wikipedia lists it as an English proverb, so I suspect it is recorded in old books, but none is listed.
So I tried searching on “Guttenberg ‘cross the bridge till you come,'” and found The Golden Legend, a poem from 1851 by Henry Wadsworth Longfellow. Included in a conversation with Lucifer:
That, my good woman, I have not said. Don’t cross the bridge till you come to it. Is a proverb old, and of excellent wit.
So apparently the saying was well known by 1851.