Thanks for reaching out. Welcome to the community!
When you accept the invite, you'll be added to the Premium for Family plan when your current billing period runs out. You won't be charged for your account any further, and your payments will be handled by the plan owner. You do not need to cancel your Premium for Students beforehand.
However, if you'd still like to cancel your Premium for Students subscription, check out this support article for the next steps to take.
Let me know if you have any questions. Happy listening :)