There are many reasons why Baldur's Gate 3 cannot cast spells. Players must solve them in different ways on different occasions. If they are in a battle, they must avoid silence skills.
First of all, when players use spells, they need to equip a staff before they can cast spells.
Secondly, it is impossible to cast spells in some special tasks, such as the teleporting monsters in the Shadow Land.
They will give you a kidnapping buff and teleport away, which will make the players very distressed.
Also, if you are silenced during battle, you will not be able to cast spells.