Some prisoners and prison systems allow what's called a compassionate release which allows the prisoner to leave prison for a short amount of time to attend the funeral of a family member.
But it can depend on the prisoner and what crime they've committed etc as to whether they'll be allowed to leave prison grounds to attend the funeral.