is it legal to have a 3 way marriage
In most countries, it is not explicitly illegal for three or more people to form and share a sexual relationship (subject sometimes to laws against homosexuality), though such relational forms risk running afoul of state or local ordinances banning unmarried cohabitation. No Western country permits statutory marriage between more than two people. Nor do they give strong and equal legal protection (e.g., of rights relating to children) to non-married partners -- the legal regime is not comparable to that applied to married couples. Individuals involved in polyamorous relationships are considered by the law to be no different from people who live together or date under other circumstances.
Group marriage