Joining MDF shelf to extend length of spare pieces
You'd need to add substantial rigidity and strength via dowels or other means of connection. It's not a material that tolerates bending stress well. The effort to do it properly probably isn't worth the cost of a new 6' or 8' shelf board.
If you were to precisely drill for say six 1/4&quot; x 4&quot; hardwood dowels and liberally apply wood glue to everything it would probably hold fairly well.
Otherwise you need to support it either with a bracket at the joint or lengthwise rails of some sort.