When creating an amide from a carboxylic acid, first an intermediate is formed - the ammonium salt of the acid. This is then dehydrated into an amide, usually by heating which drives off H2O from the reaction.
RCOOH (NH3)-> [RCOO-][NH4+], or RCOONH4
RCOONH4 (-H2O)-> RCONH2
Usually heating above 100C is enough to accomplish this - boiling the water out of solution. However, this can be problematic, one because the amines often have even lower boiling points and two in this case because the ergot compounds are thermally unstable.
POCl3 is an acid chloride...as an acid halide, it will react with water to form HCl:
POCl3 + 3H2O -> H3PO4 + 3HCl
In this way, it allows the dehydration to take place at lower temperatures than boiling would require. Other suitable agents would include thionyl chloride (SOCl2), other acid halides and anhydrides...and phosgene but that's a bad idea
This is why the POCl3 causes the reaction to occur.