Welcome to the forum.
Yes it is possible, but not very practical, for the work and cost involved.
You would need transmission and transfer case from 4WD Ranger, you can't use your 2WD trans.
The whole front suspension and axle from a 4WD Ranger, drill the 2WD frame to make it work.
Change oil pan on engine to clear front axle.
Get drive lines from 4WD Ranger.
Add wiring harness and modules for 4WD control(or find a manual transfer case)
Much cheaper to just sell the 2WD and buy a 4WD to fix it up.
Not sure what you mean with the motor question?
4WD Rangers came with 2.3l(4 cylinder), 3.0l and 4.0l V6s engines, same engines as 2WD Rangers, although the 4 cylinder 4WDs are few and far between, and none after 1998.