In Dunkirk (2017) two of the characters rush from the beach onto the pier with a stretcher and barely make it in time to get on the boat as it is leaving. After they deliver the man on the stretcher, they are then yelled at and told to get off the boat.
What was the harm in allowing them to stay on board at that point? They had helped board an injured person and there was clearly enough room for two more and the boat was in the process of leaving already anyway.
As Paulie_D said the ship was for wounded and medical personnel only. Moreover there were thousands of people waiting in the line to board the ship. If they had let them in the boat it would have been unfair for all those people.