The sex of monarch larvae can be determined only in dissection. Males will have a testis located in the 6th abdominal segment, dorsal to the gut. If you have a last instar male caterpillar, the testis will appear as two bright red or pink sacs; often they appear to be one sac.
To determine the sex of pupae requires only keen eyes or a dissecting microscope. Surrounding the cremaster (the structure from which the pupa hangs) are a series of rings, called abdominal sternites. Within the first ring (9th abdominal sternite) are several paired black dots next to the cremaster; turn the pupa so that you are looking at these dots. If the monarch is a female, the ring adjacent to the 9th sternite will have a line dissecting it; this line (indicated by the arrows on the photo and diagram below) will be centered between the pairs of dots. Male monarch pupae do not have this line.
Diagram modified from: Hughes, P. R., C. D. Radke, and J. A. A. Renwick. 1993. A Simple, Low-Input Method for Continuous Laboratory Rearing of the Monarch Butterfly (Lepidoptera: Danaidae) for Research. American Entomologist 39: 109-111.
Male Monarch: Notice the thin vein pigmentation and swollen pouches on the hindwings.
Female Monarch: Notice the thick vein pigmentation and no hindwing pouches.