user5142 is correct that they are synonyms in British English use. I'll add that the same is true of Irish English use.
In official usage, both countries now tend to use prison.
Gaol and jail are both found, one is not a misspelling of the other, but both are close-cousins who came into English in the Middle English period from Norman and central French respectively. Jail has been increasingly in popularity over gaol in all forms of English for centuries, and is now far more often found.
The terms may be found in the names of given prisons though, in which case it is normally kept as it is in the name. Hence usually "Stirling Old Town Jail", very rarely "Stirling Old Town Gaol", and usually "Kilmainham Gaol", very rarely "Kilmainham Jail".
Official name changes may have an effect, so while we might speak proleptically of Oscar Wilde having been in HM Prison Reading, we are more likely to talk of his having been in Reading Gaol, as it was called at the time. (And of course, we'd only use that in terms of the famous poem). For a similar Irish example, Mountjoy Prison was once Mountjoy Gaol.
The modern official names are the form "HM Prison X" for British prisons, and most Irish prisons have the form "X Prison", but some don't have any such word in them. None in current use have Jail or Gaol in their names.
In colloquial use, some in Britain and Ireland will use jail for remand or short-term detention, and prison for those serving sentences, but this use is not universal, so each term can be found for each condition. Some will even use jail for police/garda custody, or the holding cells one would be in when in such custody, which does not match any official terms.
Historically, the distinction was not made as can be seen from the names of different places holding the same category of prisoner containing Jail in some cases, Gaol in others and Prison in yet others. This includes debtor's prisons/jails/gaols; a category of prison that no longer exists.