Yes it is a necessary part of the sacrament. The priest imposes penance as well as granting absolution for good reason.
The fact is that, while absolution (forgiveness from God) is necessary (as I would have to apologise to my husband if I spilt red wine all over his favourite white shirt), the consequences of our sin (just like the stain on my husband’s shirt) remain even after being forgiven.
True repentance includes a desire to repair the harm done by one’s sin as far as possible, which is what the penance does. In the same manner, if I am truly desirous of repairing my relationship with my husband, I’ll either wash his shirt, send it to the cleaner’s if I’m inept at getting red wine stains out, or buy him a new shirt if the stained one is beyond cleaning.
Can you imagine me apologising to my husband but at the same time not even offering to repair the damage, clean his shirt or what have you? It would certainly indicate that my repentance was somewhat insincere.
Any sin, to be mortal, must be done consciously. So if you honestly forget to do the penance it’s certainly not a mortal sin, and unlikely to be even a venial one.
If you deliberately choose not to do it (absent a good reason such as the penance becoming impossible to do for some reason) then it is certainly a sin. I am inclined to think it would be grave, as it would probably show you’re not really taking the sacrament of confession seriously.