No, it is not necessary to speak in Portuguese to apply for the D4 research visa. It is advised that you have some knowledge of the Portuguese language. It can prove to be an advantage while working in your field in Portugal and working smoothly in the institution you are enrolled in.