These gaps in the bridges are known as expansion joints. Expansion joints are basically gaps in the bridge that allow the bridge to expand and contract. Without these gaps, the bridge may fall apart.
Bridges are typically made of concrete and/or steel. These components expand with higher temperature and contract at lower temperatures. Bridges also move with traffic loading.
You may be interested to know that there are also expansion joints in the bridge railing, bridge conduit and bridge barrier. These usually have one piece that moves inside of the other to allow the bridge to expand and contract.