派遣 refers to sending a worker to another company while he/she is still employed by the original company. If someone works under the command of Company X but is paid salary by Company Y, he/she is called a 派遣社員. This can happen in various forms, but typical, "so-called" 派遣社員's are employees of large 派遣会社 (temporary staff agencies) dedicated for offering 派遣. They engage in various types of (sometimes unimportant, sometimes special) labor, but they usually don't have enough chances to get promoted. Despite its own advantages, generally speaking, 派遣 is not seen as an ideal style of working.
出向 is not a legal term, but it basically refers to temporarily sending someone to an associated company/office for various reasons. A 出向社員 is employed by the new company, but expected to go back to their original workplace usually after a few months or years. One important difference is that 出向 is often seen as a good chance to develop the career of an elite worker. In the case of 出向, one may be sent as a manager or even a board member of the new company. Kachō Kōsaku Shima is a manga which depicts a salaryman who experiences a number of 出向's within an imaginary conglomerate, until he finally becomes a president. (There are negative 出向, too.)