Pry the molding off the wall working at each stud. Drive a broad chisel-type joint knife between the baseboard and wall. Pull out on the handle several times to loosen the molding enough to wedge a crowbar behind it.
Hold the fixture and splice the wires together, cap them with wire nuts and fold them up into the fixture box. Slide the base plate over the wires and thread the coupler nut onto the threaded rod to push the base plate up and hold it in place. Adjust the position of the base plate by turning the coupler until it’s snug against the ceiling.
Often a wall receptacle from an upper floor can be used as a source for a new ceiling fixture below, but a switch loop must be run to a wall switch in addition to fishing the cable from the source.
If there are several ground wires, tie them all together with a short pieces of wire to connect to the terminal screws. There is no hole in the receptacle or switch for the ground wire, only a screw.