As you need to get this in Illustrator, you might need some nice aligned text. I'm just hoping you don"t have too much or my method will be too time consuming.
>The method below can be re-used to create customized labelling for contour lines<
Let's take an example with contour_lines layer where you have stored your Z values. the Z values displayed below are automatic labels, they don't "exist", in a definite X,Y place, it's interactive, so it can't be exported. that's what this method is about, making those attributes located in space :

Create a layer called crosslines (red below) with lines along where you need to get text written. As it's contour lines you're dealing with, there are best aligned when in line :

Add in each layer a unique Id column (ex : UID_Z and UID_CROSS with values = $id). Open the Line intersections tool in the processing window an fill in the values like below :


You will obtain points where lines cross :

Join this point layer and the contour_line layer with the uid_Z field :

You will now have a set of point with the Z values. If you center the values on the point, you label like that :

You have now a GIS layer of (X,Y) space located points on the contour lines with Z values. Export in .mif for example or any GIS format Mapublisher reads (except DXF that doesn't takes attributes) and open in Mapublisher for labeling. You might have to work on angular matters if you need rotation, but it should be easier this way. For angles, you might need to pass on to the points the crossline angle maybe. But that's another question...