There can be many reasons behind a friendly fire. All in all, a friendly fire could be a situation of poor planning in the mission or it could be a malfunction of the gear being used in the war. Nevertheless, friendly fire is not accepted at all and neither is it tolerated.
Though it is unfortunate that according to statistics, about 30% of all the causalities that are faced in war happen due to friendly fire. The culprit who is involved in a friendly fire is investigated thoroughly in order to find the root cause of the incident. So yes, if a friendly fire is proved to have underlying causes other than a mistake, then there is a punishment.