Answer:
Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
A Muslim husband should help his wife to obey Allah and implement His rulings. Thus, he should not prevent her from keeping kinship relations with her family and sharing their joys.
However, if a husband prevents his wife from going out, then it is her duty to obey him. In this case, she should not go out even to visit her parents let alone friends or other relatives. Sheikh
al-Islam Ibn Taymiyah said:
'If a woman gets married her husband becomes more entitled to control her than her parents and more entitled to her obedience than her parents' . He also said:
'She is not allowed to go out without his permission regardless of who demands her to go out, whether her parents or others. Muslim scholars do not have any disagreement in this regard' .
Ibn Qudamah wrote in his book al-Mughni:
'A husband can prevent his wife from going out whether it is for visiting parents, or attending the funeral procession of one of them" . Imam
Ahmad was asked about a married woman whose mother is sick. He said:
'Obeying her husband is more obligatory than visiting her mother' .
However, what your husband did is not acceptable; he should not have done so, particularly for the reason that he was not invited directly.
Allah knows best.