If the 4 wheel drive is engaged electronically through a button and not manual then it could be the speed sensor or even a fuse out between the 4 wheel drive button and the gear box where it engages.
Although not on a jeep Cherokee I found on A Chevy truck the wire had broken into on the steering column where the button for the 4 wheel drive is located on the shift lever.
The wire had broken into.
It could be too that your 4 wheel drive gear box has gone out and not engaging into 4 wheel drive.