Forward foreign exchange transactions occur if both companies have a currency the other needs. It prevents negative foreign exchange risk for either party. The most common use of foreign exchange swaps is for institutions to fund their foreign exchange balances. In order to collect or pay any overnight interest due on these foreign balances, at the end of every day institutions will close out any foreign balances and re-institute them for the following day. The interest collected or paid every night is referred to as the cost of carry.
Companies may also use them to avoid foreign exchange risk. A British Company may be long EUR from sales in Europe but operate primarily in Britain using GBP. However, they know that they need to pay their manufacturers in Europe in 1 month. They could spot sell their EUR and buy GBP to cover their expenses in Britain, and then in one month spot buy EUR and sell GBP to pay their business partners in Europe. However, this exposes them to FX risk. Thus, the value of the swap points is roughly proportional to the interest rate differential. A foreign exchange swap should not be confused with a currency swap, which is a rarer long-term transaction governed by different rules.