What if it’s just because of the husbands ego or he simply doesn’t think she should leave the house? Wouldn’t that be loosing all her freedom? Islam has given women every right but she doesn’t have those rights simply because the husband refuses to. Also I read somewhere that husband’s are considered next to God to their wives in islam, why is this so?

Husband is not considered next to God. Basically Islam came to provide safety and protection for wives. So I am not sure why he wouldn't allow you to leave the house for genuine reasons.