There's no relationship. Bahai rules do not allow their members to join secret organisations, such as the Masons. Any who may break the rule, are likely to lose their administrative rights in the Bahai community. This was, for example, stipulated by Shoghi Effendi in a cable in 1954 (see http://reference.bahai.org/en/t/se/UD/ud-443.html for the text).
Freemasons' attitude to the Bahais varies. One French Freemason journal, La Chaîne d'union de Paris : journal de la maçonnerie universelle ... for July
- August 1889, has an article at pp. 239-248 called Les Babis de la Perse et la Francmaconnerie Universelle, by A. Hubert-Gourrier. He concludes at page 248:
"Universal Freemasonry not only has nothing in common with Babism, in respect to its origin, its principles or its goal; it is bound to combat Babism as an immoral and anti-humane institution. ... Universal Freemasonry, as the protector of humanity, must resolve to destroy this obstacle which temporarily impedes universal progress."
(Babi) here refers to both the Babi and the Bahai Faiths. French freemasonry at the time was militantly anti-religion, which would not I think be true of Scottish freemasonry at the time, or American freemasonry today. So the most one can say is that the two movements have little in common, and sometimes Freemasonry may have been vigorously anti-Bahai.
That journal is available online at gallica.bnf.fr, the site of the Biblioteque Nationale de France