What is the correct way to share a washing machine receptacle with a printer?
Washing machines require dedicated circuits. This code excerpt implies that the only receptacle available for a washing machine should be the one that the appliance itself is plugged into.


  210.10(C)(2) Laundry Branch Circuits. In addition to the number of branch circuits required by other parts of this section, at least one
  additional 20-ampere branch circuit shall be provided to supply the
  laundry receptacle outlet(s) required by
  210.52(F). This circuit shall have no other outlets.


Source: 2008 NEC, the latest version I have, but I know this requirement has not changed meaningfully since then.

In general, any high-powered AC motor or electrical heating element (washing machine, refrigerator, garbage disposal, dishwasher, microwave, etc.) should be on a dedicated circuit. These tend to draw a lot of amps, and AC motors spike above their typical current draw when starting because they have to charge some pretty big capacitors. For example, an AC motor that draws 12 amps might spike at 18 amps when starting. If you already have a load on that circuit, you may trip a breaker (maybe not - they do not necessarily trip because of a momentary spike - and the circumstances that cause them to trip is a little more complex. Best not to tempt fate).

The correct thing to do here is one of the following:


Use a different circuit that is available in that location.
Run another circuit for the printer. As laser printers can also cause a current spike and I have actually seen them (personal experience) cause lights to fade momentarily, a dedicated circuit for one is not a bad idea, even if it is not required.
Plug into another circuit elsewhere in the house, possibly using an extension cord to move the printer where you want it as Iggy suggests. I recommend using a heavy-duty extension cord capable of carrying whatever current the printer requires over the full length of the extension cord. Too often I see people use dinky little extension cords that work fine for lamps, but will overheat under high loads such as with laser printers, power tools, yard equipment, etc. If the extension cord is exposed at all, you also want it to be durable to avoid damage. Personally, I only buy heavy-duty outdoor-rated extension cords capable of carrying 15 or 20 amps, even for indoor uses.